Commit bbfc566c authored by webchick's avatar webchick

Issue #1820834 by sun: Change #type machine_name() default 'source' element to 'label'.

parent b48bf9b6
......@@ -3537,7 +3537,7 @@ function form_process_tableselect($element) {
* value differs from the element's #default_value.
* - source: (optional) The #array_parents of the form element containing
* the human-readable name (i.e., as contained in the $form structure) to
* use as source for the machine name. Defaults to array('name').
* use as source for the machine name. Defaults to array('label').
* - label: (optional) A text to display as label for the machine name value
* after the human-readable name form element. Defaults to "Machine name".
* - replace_pattern: (optional) A regular expression (without delimiters)
......@@ -3570,8 +3570,7 @@ function form_process_machine_name($element, &$form_state) {
// 'source' only) would leave all other properties undefined, if the defaults
// were defined in hook_element_info(). Therefore, we apply the defaults here.
$element['#machine_name'] += array(
// @todo Use 'label' by default.
'source' => array('name'),
'source' => array('label'),
'target' => '#' . $element['#id'],
'label' => t('Machine name'),
'replace_pattern' => '[^a-z0-9_]+',
......
......@@ -214,8 +214,6 @@ function config_test_form($form, &$form_state, ConfigTest $config_test = NULL) {
'#required' => TRUE,
'#machine_name' => array(
'exists' => 'config_test_load',
// @todo Update form_process_machine_name() to use 'label' by default.
'source' => array('label'),
),
);
$form['style'] = array(
......
......@@ -36,7 +36,6 @@ public function form(array $form, array &$form_state, EntityInterface $category)
'#default_value' => $category->id(),
'#machine_name' => array(
'exists' => 'contact_category_load',
'source' => array('label'),
),
'#disabled' => !$category->isNew(),
);
......
......@@ -181,6 +181,7 @@ function filter_admin_format_form($form, &$form_state, $format) {
'#maxlength' => 255,
'#machine_name' => array(
'exists' => 'filter_format_exists',
'source' => array('name'),
),
'#disabled' => !empty($format->format),
);
......
......@@ -59,7 +59,6 @@ function image_style_form($form, &$form_state, $style) {
'#default_value' => $style->id(),
'#machine_name' => array(
'exists' => 'image_style_load',
'source' => array('label'),
),
'#required' => TRUE,
);
......@@ -246,7 +245,6 @@ function image_style_add_form($form, &$form_state) {
'#type' => 'machine_name',
'#machine_name' => array(
'exists' => 'image_style_load',
'source' => array('label'),
),
'#default_value' => '',
'#required' => TRUE,
......
......@@ -132,6 +132,7 @@ function node_type_form($form, &$form_state, $type = NULL) {
'#disabled' => $type->locked,
'#machine_name' => array(
'exists' => 'node_type_load',
'source' => array('name'),
),
'#description' => t('A unique machine-readable name for this content type. It must only contain lowercase letters, numbers, and underscores. This name will be used for constructing the URL of the %node-add page, in which underscores will be converted into hyphens.', array(
'%node-add' => t('Add new content'),
......
......@@ -37,6 +37,7 @@ public function form(array $form, array &$form_state, EntityInterface $vocabular
'#maxlength' => 255,
'#machine_name' => array(
'exists' => 'taxonomy_vocabulary_machine_name_load',
'source' => array('name'),
),
);
$form['description'] = array(
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment