Commit 24070c3c authored by John Voskuilen's avatar John Voskuilen
Browse files

Issue #3273363: clean code by uniform #type/#title order in element declaration

parent e1207670
Loading
Loading
Loading
Loading
+7 −6
Original line number Diff line number Diff line
@@ -74,8 +74,8 @@ abstract class OfficeHoursFormatterBase extends FormatterBase {
     */

    $element['show_closed'] = [
      '#type' => 'select',
      '#title' => $this->t('Number of days to show'),
      '#type' => 'select',
      '#options' => [
        'all' => $this->t('Show all days'),
        'open' => $this->t('Show only open days'),
@@ -88,14 +88,14 @@ abstract class OfficeHoursFormatterBase extends FormatterBase {
    ];
    // First day of week, copied from system.variable.inc.
    $element['office_hours_first_day'] = [
      '#title' => $this->t('First day of week'),
      '#type' => 'select',
      '#options' => $day_names,
      '#title' => $this->t('First day of week'),
      '#default_value' => $this->getSetting('office_hours_first_day'),
    ];
    $element['day_format'] = [
      '#type' => 'select',
      '#title' => $this->t('Day notation'),
      '#type' => 'select',
      '#options' => [
        'long' => $this->t('long'),
        'short' => $this->t('3-letter weekday abbreviation'),
@@ -107,8 +107,8 @@ abstract class OfficeHoursFormatterBase extends FormatterBase {
    ];
    // @todo D8 Align with DateTimeDatelistWidget.
    $element['time_format'] = [
      '#type' => 'select',
      '#title' => $this->t('Time notation'),
      '#type' => 'select',
      '#options' => [
        'G' => $this->t('24 hour time') . ' (9:00)', // D7: key = 0.
        'H' => $this->t('24 hour time') . ' (09:00)', // D7: key = 2.
@@ -134,9 +134,9 @@ abstract class OfficeHoursFormatterBase extends FormatterBase {
      '#required' => FALSE,
    ];
    $element['closed_format'] = [
      '#title' => $this->t('Empty days notation'),
      '#type' => 'textfield',
      '#size' => 30,
      '#title' => $this->t('Empty days notation'),
      '#default_value' => $settings['closed_format'],
      '#required' => FALSE,
      '#description' => $this->t('Format of empty (closed) days. String
@@ -197,8 +197,8 @@ abstract class OfficeHoursFormatterBase extends FormatterBase {
        ]),
    ];
    $element['current_status']['position'] = [
      '#type' => 'select',
      '#title' => $this->t('Current status position'),
      '#type' => 'select',
      '#options' => [
        '' => $this->t('Hidden'),
        'before' => $this->t('Before hours'),
@@ -247,6 +247,7 @@ abstract class OfficeHoursFormatterBase extends FormatterBase {
    else {
      $element['timezone_field'] = [
        '#type' => 'hidden',
        '#title' => $this->t('Timezone') . ' ' . $this->t('Field'),
        '#value' => $settings['timezone_field'],
      ];
    }
+1 −1
Original line number Diff line number Diff line
@@ -50,7 +50,7 @@ class OfficeHoursFormatterTable extends OfficeHoursFormatterBase {
      return $elements;
    }

    // For a11y screen readers, a header is introduced.
    // For accessibility (a11y) screen readers, a header/title is introduced.
    // Superfluous comments are removed. @see #3110755 for examples and explanation.
    $isLabelEnabled = $settings['day_format'] != 'none';
    $isTimeSlotEnabled = TRUE;