You are here

public function HideOnPages::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/HideOnPages.php, line 23

Class

HideOnPages
The plugin for check empty fields.

Namespace

Drupal\fico\Plugin\Field\FieldFormatter\Condition

Code

public function alterForm(&$form, $settings) {
  $default_visibility = isset($settings['settings']['visibility']) ? $settings['settings']['visibility'] : 0;
  $default_pages = isset($settings['settings']['pages']) ? $settings['settings']['pages'] : '';
  $form['visibility'] = array(
    '#title' => t('Type of display'),
    '#type' => 'radios',
    '#options' => array(
      0 => t('All pages except those listed'),
      1 => t('Only the listed pages'),
    ),
    '#default_value' => $default_visibility,
  );
  $form['pages'] = array(
    '#type' => 'textarea',
    '#title' => t('Enter pages'),
    '#cols' => 10,
    '#default_value' => $default_pages,
    '#description' => t("Specify pages by using their paths. Enter one path per line. * is used as wildcard."),
  );
}