You are here

public function FlexiformElementEntityProperty_date::form in Flexiform 7

Return the form element for this FlexiformElement.

Overrides FlexiformElementEntityProperty::form

File

includes/element/property/date.property.element.inc, line 9
Contains FlexiformElementEntityProperty_date.

Class

FlexiformElementEntityProperty_date
@file Contains FlexiformElementEntityProperty_date.

Code

public function form($form, &$form_state, $entity, $language = LANGUAGE_NONE) {
  $form = parent::form($form, $form_state, $entity, $language);
  if (module_exists('date_popup')) {
    $form[$this->element_namespace]['#type'] = 'date_popup';
    $form[$this->element_namespace]['#date_format'] = 'M d Y H:i';
    if ($default = $form[$this->element_namespace]['#default_value']) {
      $form[$this->element_namespace]['#default_value'] = date('Y-m-d H:i', $form[$this->element_namespace]['#default_value']);
    }
  }
  return $form;
}