Issue #1820834 by sun: Change #type machine_name() default 'source' element to 'label'.
parent
b48bf9b663
commit
bbfc566c7f
|
@ -3537,7 +3537,7 @@ function form_process_tableselect($element) {
|
||||||
* value differs from the element's #default_value.
|
* value differs from the element's #default_value.
|
||||||
* - source: (optional) The #array_parents of the form element containing
|
* - source: (optional) The #array_parents of the form element containing
|
||||||
* the human-readable name (i.e., as contained in the $form structure) to
|
* 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
|
* - label: (optional) A text to display as label for the machine name value
|
||||||
* after the human-readable name form element. Defaults to "Machine name".
|
* after the human-readable name form element. Defaults to "Machine name".
|
||||||
* - replace_pattern: (optional) A regular expression (without delimiters)
|
* - 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
|
// 'source' only) would leave all other properties undefined, if the defaults
|
||||||
// were defined in hook_element_info(). Therefore, we apply the defaults here.
|
// were defined in hook_element_info(). Therefore, we apply the defaults here.
|
||||||
$element['#machine_name'] += array(
|
$element['#machine_name'] += array(
|
||||||
// @todo Use 'label' by default.
|
'source' => array('label'),
|
||||||
'source' => array('name'),
|
|
||||||
'target' => '#' . $element['#id'],
|
'target' => '#' . $element['#id'],
|
||||||
'label' => t('Machine name'),
|
'label' => t('Machine name'),
|
||||||
'replace_pattern' => '[^a-z0-9_]+',
|
'replace_pattern' => '[^a-z0-9_]+',
|
||||||
|
|
|
@ -214,8 +214,6 @@ function config_test_form($form, &$form_state, ConfigTest $config_test = NULL) {
|
||||||
'#required' => TRUE,
|
'#required' => TRUE,
|
||||||
'#machine_name' => array(
|
'#machine_name' => array(
|
||||||
'exists' => 'config_test_load',
|
'exists' => 'config_test_load',
|
||||||
// @todo Update form_process_machine_name() to use 'label' by default.
|
|
||||||
'source' => array('label'),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
$form['style'] = array(
|
$form['style'] = array(
|
||||||
|
|
|
@ -36,7 +36,6 @@ class CategoryFormController extends EntityFormController {
|
||||||
'#default_value' => $category->id(),
|
'#default_value' => $category->id(),
|
||||||
'#machine_name' => array(
|
'#machine_name' => array(
|
||||||
'exists' => 'contact_category_load',
|
'exists' => 'contact_category_load',
|
||||||
'source' => array('label'),
|
|
||||||
),
|
),
|
||||||
'#disabled' => !$category->isNew(),
|
'#disabled' => !$category->isNew(),
|
||||||
);
|
);
|
||||||
|
|
|
@ -181,6 +181,7 @@ function filter_admin_format_form($form, &$form_state, $format) {
|
||||||
'#maxlength' => 255,
|
'#maxlength' => 255,
|
||||||
'#machine_name' => array(
|
'#machine_name' => array(
|
||||||
'exists' => 'filter_format_exists',
|
'exists' => 'filter_format_exists',
|
||||||
|
'source' => array('name'),
|
||||||
),
|
),
|
||||||
'#disabled' => !empty($format->format),
|
'#disabled' => !empty($format->format),
|
||||||
);
|
);
|
||||||
|
|
|
@ -59,7 +59,6 @@ function image_style_form($form, &$form_state, $style) {
|
||||||
'#default_value' => $style->id(),
|
'#default_value' => $style->id(),
|
||||||
'#machine_name' => array(
|
'#machine_name' => array(
|
||||||
'exists' => 'image_style_load',
|
'exists' => 'image_style_load',
|
||||||
'source' => array('label'),
|
|
||||||
),
|
),
|
||||||
'#required' => TRUE,
|
'#required' => TRUE,
|
||||||
);
|
);
|
||||||
|
@ -246,7 +245,6 @@ function image_style_add_form($form, &$form_state) {
|
||||||
'#type' => 'machine_name',
|
'#type' => 'machine_name',
|
||||||
'#machine_name' => array(
|
'#machine_name' => array(
|
||||||
'exists' => 'image_style_load',
|
'exists' => 'image_style_load',
|
||||||
'source' => array('label'),
|
|
||||||
),
|
),
|
||||||
'#default_value' => '',
|
'#default_value' => '',
|
||||||
'#required' => TRUE,
|
'#required' => TRUE,
|
||||||
|
|
|
@ -132,6 +132,7 @@ function node_type_form($form, &$form_state, $type = NULL) {
|
||||||
'#disabled' => $type->locked,
|
'#disabled' => $type->locked,
|
||||||
'#machine_name' => array(
|
'#machine_name' => array(
|
||||||
'exists' => 'node_type_load',
|
'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(
|
'#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'),
|
'%node-add' => t('Add new content'),
|
||||||
|
|
|
@ -37,6 +37,7 @@ class VocabularyFormController extends EntityFormController {
|
||||||
'#maxlength' => 255,
|
'#maxlength' => 255,
|
||||||
'#machine_name' => array(
|
'#machine_name' => array(
|
||||||
'exists' => 'taxonomy_vocabulary_machine_name_load',
|
'exists' => 'taxonomy_vocabulary_machine_name_load',
|
||||||
|
'source' => array('name'),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
$form['description'] = array(
|
$form['description'] = array(
|
||||||
|
|
Loading…
Reference in New Issue