You are here

public function Date::getDefaultProperties in YAML Form 8

Only a few elements don't inherit these default properties.

Overrides DateBase::getDefaultProperties

See also

\Drupal\yamlform\Plugin\YamlFormElement\Textarea

\Drupal\yamlform\Plugin\YamlFormElement\YamlFormLikert

\Drupal\yamlform\Plugin\YamlFormElement\YamlFormCompositeBase

\Drupal\yamlform\Plugin\YamlFormElement\ContainerBase

File

src/Plugin/YamlFormElement/Date.php, line 24

Class

Date
Provides a 'date' element.

Namespace

Drupal\yamlform\Plugin\YamlFormElement

Code

public function getDefaultProperties() {
  $date_format = '';

  // Date formats cannot be loaded during install or update.
  if (!defined('MAINTENANCE_MODE')) {

    /** @var \Drupal\Core\Datetime\DateFormatInterface $date_format_entity */
    if ($date_format_entity = DateFormat::load('html_date')) {
      $date_format = $date_format_entity
        ->getPattern();
    }
  }
  return parent::getDefaultProperties() + [
    // Date settings.
    'date_date_format' => $date_format,
    'step' => '',
  ];
}