public function Datetime::getInfo

public Datetime::getInfo()

Returns the element properties for this element.

Return value

array An array of element properties. See \Drupal\Core\Render\ElementInfoManagerInterface::getInfo() for documentation of the standard properties of all elements, and the return value format.

Overrides ElementInterface::getInfo

File

core/lib/Drupal/Core/Datetime/Element/Datetime.php, line 25

Class

Datetime
Provides a datetime element.

Namespace

Drupal\Core\Datetime\Element

Code

public function getInfo() {
  $date_format = '';
  $time_format = '';
  // Date formats cannot be loaded during install or update.
  if (!defined('MAINTENANCE_MODE')) {
    if ($date_format_entity = DateFormat::load('html_date')) {
      /** @var $date_format_entity \Drupal\Core\Datetime\DateFormatInterface */
      $date_format = $date_format_entity->getPattern();
    }
    if ($time_format_entity = DateFormat::load('html_time')) {
      /** @var $time_format_entity \Drupal\Core\Datetime\DateFormatInterface */
      $time_format = $time_format_entity->getPattern();
    }
  }

  $class = get_class($this);
  return array(
    '#input' => TRUE,
    '#element_validate' => array(
      array($class, 'validateDatetime'),
    ),
    '#process' => array(
      array($class, 'processDatetime'),
      array($class, 'processGroup'),
    ),
    '#pre_render' => array(
      array($class, 'preRenderGroup'),
    ),
    '#theme' => 'datetime_form',
    '#theme_wrappers' => array('datetime_wrapper'),
    '#date_date_format' => $date_format,
    '#date_date_element' => 'date',
    '#date_date_callbacks' => array(),
    '#date_time_format' => $time_format,
    '#date_time_element' => 'time',
    '#date_time_callbacks' => array(),
    '#date_year_range' => '1900:2050',
    '#date_increment' => 1,
    '#date_timezone' => '',
  );
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Datetime!Element!Datetime.php/function/Datetime::getInfo/8.1.x