Commit f503d228 authored by webchick's avatar webchick
Browse files

Issue #2074509 by tim.plunkett, falcon03, mgifford, Xano: Fixed Add missing...

Issue #2074509 by tim.plunkett, falcon03, mgifford, Xano: Fixed Add missing #title property to ensure form accessibility.
parent 11eeb98b
......@@ -2470,6 +2470,7 @@ function _install_configure_form($form, &$form_state, &$install_state) {
);
$form['update_notifications']['update_status_module'] = array(
'#type' => 'checkboxes',
'#title' => t('Update notifications'),
'#options' => array(
1 => t('Check for updates automatically'),
2 => t('Receive e-mail notifications'),
......
......@@ -72,7 +72,6 @@ public function form(array $form, array &$form_state) {
$form['id'] = array(
'#type' => 'machine_name',
'#title' => $this->t('Machine name'),
'#default_value' => $this->entity->id(),
'#disabled' => !$this->entity->isNew(),
'#maxlength' => 64,
......
......@@ -102,7 +102,6 @@ public function form(array $form, array &$form_state) {
// If creating a new block, calculate a safe default machine name.
$form['machine_name'] = array(
'#type' => 'machine_name',
'#title' => $this->t('Machine name'),
'#maxlength' => 64,
'#description' => $this->t('A unique name for this block instance. Must be alpha-numeric and underscore separated.'),
'#default_value' => !$entity->isNew() ? $entity->id() : $this->getUniqueMachineName($entity),
......
......@@ -262,8 +262,8 @@ public function buildForm(array $form, array &$form_state) {
'#type' => 'select',
'#default_value' => $region,
'#empty_value' => BLOCK_REGION_NONE,
'#title_display' => 'invisible',
'#title' => t('Region for @block block', array('@block' => $info['admin_label'])),
'#title_display' => 'invisible',
'#options' => $this->regions,
'#attributes' => array(
'class' => array('block-region-select', 'block-region-' . $region),
......@@ -279,8 +279,8 @@ public function buildForm(array $form, array &$form_state) {
'#type' => 'weight',
'#default_value' => $info['weight'],
'#delta' => $weight_delta,
'#title_display' => 'invisible',
'#title' => t('Weight for @block block', array('@block' => $info['admin_label'])),
'#title_display' => 'invisible',
'#attributes' => array(
'class' => array('block-weight', 'block-weight-' . $region),
),
......
......@@ -160,6 +160,8 @@ function _book_admin_table_tree($tree, &$form) {
'depth' => array('#type' => 'value', '#value' => $data['link']['depth']),
'href' => array('#type' => 'value', '#value' => $data['link']['href']),
'title' => array(
'#title' => t('Title'),
'#title_display' => 'invisible',
'#type' => 'textfield',
'#default_value' => $data['link']['link_title'],
'#maxlength' => 255,
......
......@@ -118,6 +118,7 @@ function comment_admin_overview($form, &$form_state, $arg) {
'#account' => comment_prepare_author($comment),
);
$options[$comment->id()] = array(
'title' => array('data' => array('#title' => $comment->subject->value ?: $comment->id())),
'subject' => array(
'data' => array(
'#type' => 'link',
......
......@@ -88,8 +88,8 @@ protected function buildFormStyle(array &$form, array &$form_state, $type) {
case 'comment':
$style_form['row_options']['links'] = array(
'#type' => 'select',
'#title_display' => 'invisible',
'#title' => t('Should links be displayed below each comment'),
'#title_display' => 'invisible',
'#options' => array(
1 => t('with links (allow users to reply to the comment, etc.)'),
0 => t('without links'),
......
......@@ -59,9 +59,10 @@ public function buildForm(array $form, array &$form_state) {
);
$form['import_tarball'] = array(
'#type' => 'file',
'#value' => $this->t('Select your configuration export file'),
'#title' => $this->t('Select your configuration export file'),
'#description' => $this->t('This form will redirect you to the import configuration screen.'),
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => $this->t('Upload'),
......
......@@ -89,6 +89,7 @@ function _content_translation_form_language_content_settings_form_alter(array &$
if ($fields) {
$form['settings'][$entity_type][$bundle]['translatable'] = array(
'#type' => 'checkbox',
'#title' => $bundle,
'#default_value' => content_translation_enabled($entity_type, $bundle),
);
......@@ -99,6 +100,7 @@ function _content_translation_form_language_content_settings_form_alter(array &$
$form['settings'][$entity_type][$bundle]['fields'][$field_name] = array(
'#label' => $instance['label'],
'#type' => 'checkbox',
'#title' => $instance['label'],
'#default_value' => $field['translatable'],
);
$column_element = content_translation_field_sync_widget($field, $instance);
......
......@@ -155,6 +155,8 @@ public function entityFormAlter(array &$form, array &$form_state, EntityInterfac
'#weight' => -100,
'#multilingual' => TRUE,
'source' => array(
'#title' => t('Select source language'),
'#title_display' => 'invisible',
'#type' => 'select',
'#default_value' => $source_langcode,
'#options' => array(),
......
......@@ -34,7 +34,11 @@ function getDefaultSettings() {
* Implements \Drupal\editor\Plugin\EditPluginInterface::settingsForm().
*/
function settingsForm(array $form, array &$form_state, EditorEntity $editor) {
$form['foo'] = array('#type' => 'textfield', '#default_value' => 'bar');
$form['foo'] = array(
'#title' => t('Foo'),
'#type' => 'textfield',
'#default_value' => 'bar',
);
return $form;
}
......
......@@ -82,7 +82,6 @@ public function form(array $form, array &$form_state) {
$form['id'] = array(
'#type' => 'machine_name',
'#title' => t('Machine-readable name'),
'#description' => t('A unique machine-readable name. Can only contain lowercase letters, numbers, and underscores.'),
'#disabled' => !$this->entity->isNew(),
'#default_value' => $this->entity->id(),
......
......@@ -54,6 +54,7 @@ function language_elements_configuration_element() {
*/
function language_elements_configuration_element_test() {
$form['langcode'] = array(
'#title' => t('Language select'),
'#type' => 'language_select',
'#default_value' => language_get_default_langcode('custom_type', 'some_bundle'),
);
......
......@@ -85,9 +85,10 @@
background: transparent url(../../../misc/menu-expanded.png) left .6em no-repeat;
}
#locale-translation-status-form label {
#locale-translation-status-form .label {
color: #1d1d1d;
font-size: 1.15em;
font-weight: bold;
}
#locale-translation-status-form .description {
cursor: pointer;
......
......@@ -167,7 +167,7 @@ function testUpdateImportSourceRemote() {
$this->drupalGet('admin/reports/translations/check');
// Check the status on the Available translation status page.
$this->assertRaw('<label for="edit-langcodes-de" class="language-name">German</label>', 'German language found');
$this->assertRaw('<label class="visually-hidden" for="edit-langcodes-de">Update German</label>', 'German language found');
$this->assertText('Updates for: Contributed module one, Contributed module two, Custom module one, Locale test', 'Updates found');
$this->assertText('Contributed module one (' . format_date($this->timestamp_now, 'html_date') . ')', 'Updates for Contrib module one');
$this->assertText('Contributed module two (' . format_date($this->timestamp_new, 'html_date') . ')', 'Updates for Contrib module two');
......
......@@ -5,6 +5,7 @@
* Interface translation summary, editing and deletion user interfaces.
*/
use Drupal\Component\Utility\String;
use Drupal\Core\Language\Language;
use Drupal\locale\SourceString;
use Drupal\locale\TranslationString;
......@@ -520,6 +521,7 @@ function locale_translation_status_form($form, &$form_state) {
// Build data options for the select table.
foreach($updates as $langcode => $update) {
$title = String::checkPlain($languages[$langcode]->name);
$locale_translation_update_info = array('#theme' => 'locale_translation_update_info');
foreach (array('updates', 'not_found') as $update_status) {
if (isset($update[$update_status])) {
......@@ -527,12 +529,20 @@ function locale_translation_status_form($form, &$form_state) {
}
}
$options[$langcode] = array(
'title' => check_plain($languages[$langcode]->name),
'title' => array(
'class' => array('label'),
'data' => array(
'#title' => $title,
'#markup' => $title
),
),
'status' => array('class' => array('description', 'expand', 'priority-low'), 'data' => drupal_render($locale_translation_update_info)),
);
}
// Sort the table data on language name.
uasort($options, 'drupal_sort_title');
uasort($options, function ($a, $b) {
return strcasecmp($a['title']['data']['#title'], $b['title']['data']['#title']);
});
}
$last_checked = Drupal::state()->get('locale.translation_last_checked');
......@@ -639,13 +649,6 @@ function locale_translation_status_form_submit($form, &$form_state) {
* translation files could not be found.
*/
function locale_translation_language_table($form_element) {
// Add labels to Language names.
foreach ($form_element['#options'] as $langcode => $option) {
$id = $form_element[$langcode]['#id'];
$title = $option['title'];
$form_element['#options'][$langcode]['title'] = '<label for="' . $form_element[$langcode]['#id'] . '" class="language-name">' . $title . '</label>';
}
// Remove checkboxes of languages without updates.
if ($form_element['#not_found']) {
foreach ($form_element['#not_found'] as $langcode) {
......
......@@ -315,8 +315,8 @@ protected function buildOverviewTreeForm($tree, $delta) {
'#type' => 'weight',
'#delta' => $delta,
'#default_value' => $item['weight'],
'#title_display' => 'invisible',
'#title' => t('Weight for @title', array('@title' => $item['title'])),
'#title_display' => 'invisible',
);
$form[$mlid]['mlid'] = array(
'#type' => 'hidden',
......
......@@ -39,6 +39,7 @@ public function buildForm(array $form, array &$form_state) {
$options[$type->type] = $type->name;
}
$form['bundles'] = array(
'#title' => t('Node types'),
'#type' => 'checkboxes',
'#options' => $options,
'#required' => TRUE,
......
......@@ -107,8 +107,8 @@ protected function buildFormStyle(array &$form, array &$form_state, $type) {
case 'teasers':
$style_form['row_options']['links'] = array(
'#type' => 'select',
'#title_display' => 'invisible',
'#title' => t('Should links be displayed below each node'),
'#title_display' => 'invisible',
'#options' => array(
1 => t('with links (allow users to add comments, etc.)'),
0 => t('without links'),
......@@ -117,8 +117,8 @@ protected function buildFormStyle(array &$form, array &$form_state, $type) {
);
$style_form['row_options']['comments'] = array(
'#type' => 'select',
'#title_display' => 'invisible',
'#title' => t('Should comments be displayed below each node'),
'#title_display' => 'invisible',
'#options' => array(
1 => t('with comments'),
0 => t('without comments'),
......
......@@ -94,11 +94,15 @@ public function buildOptionsForm(&$form, &$form_state) {
'#markup' => $id,
);
$form['field_options'][$id]['alias'] = array(
'#title' => t('Alias for @id', array('@id' => $id)),
'#title_display' => 'invisible',
'#type' => 'textfield',
'#default_value' => isset($options[$id]['alias']) ? $options[$id]['alias'] : '',
'#element_validate' => array(array($this, 'validateAliasName')),
);
$form['field_options'][$id]['raw_output'] = array(
'#title' => t('Raw output for @id', array('@id' => $id)),
'#title_display' => 'invisible',
'#type' => 'checkbox',
'#default_value' => isset($options[$id]['raw_output']) ? $options[$id]['raw_output'] : '',
);
......
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