You are here

public function HideDateTime::alterForm in Field Formatter Condition 8

Alter the condition form.

Parameters

array $form: Condition formular.

array $settings: Settings array.

Overrides FieldFormatterConditionBase::alterForm

File

src/Plugin/Field/FieldFormatter/Condition/HideDateTime.php, line 25

Class

HideDateTime
The plugin for check empty fields.

Namespace

Drupal\fico\Plugin\Field\FieldFormatter\Condition

Code

public function alterForm(&$form, $settings) {
  $default_orientation = isset($settings['settings']['orientation']) ? $settings['settings']['orientation'] : NULL;
  $default_cutom_date = isset($settings['settings']['cutom_date']) ? $settings['settings']['cutom_date'] : NULL;
  $form['orientation'] = [
    '#title' => t('Hide if'),
    '#type' => 'radios',
    '#options' => array(
      'smaller' => t("smaller than today's date"),
      'greater' => t("greater than today's date"),
      'custom_small' => t("smaller then custom date"),
      'greater_small' => t("greater then custom date"),
    ),
    '#default_value' => $default_orientation,
  ];
  $form['cutom_date'] = [
    '#title' => t('Cutom date'),
    '#type' => 'date',
    '#default_value' => $default_cutom_date,
  ];
}