You are here

public static function OfficeHoursDatetime::processOfficeHoursTime in Office Hours 8

Process the office_hours_select element before showing it.

Parameters

$element:

\Drupal\Core\Form\FormStateInterface $form_state:

$complete_form:

Return value

array The processed element.

File

src/Element/OfficeHoursDatetime.php, line 77

Class

OfficeHoursDatetime
Provides a one-line HTML5 time element.

Namespace

Drupal\office_hours\Element

Code

public static function processOfficeHoursTime(&$element, FormStateInterface $form_state, &$complete_form) {
  $element = parent::processDatetime($element, $form_state, $complete_form);

  // @todo Use $element['#date_time_callbacks'], do not use this function.
  // Adds the HTML5 attributes.
  $element['time']['#attributes'] = [
    // @todo Set a proper from/to title.
    // 'title' => $this->t('Time (e.g. @format)', ['@format' => static::formatExample($time_format)]),
    // Fix the convention: minutes vs. seconds.
    'step' => $element['#date_increment'] * 60,
  ] + $element['time']['#attributes'];
  return $element;
}