You are here

protected function EntityViewDisplayAlterer::getSettingsInputsFromSettings in Smart Title 8

Returns the input elements for smart title.

Parameters

string[] $smart_title_settings: The active smart title settings.

\Drupal\Core\Entity\Display\EntityViewDisplayInterface $entity: The view display config entity.

Return value

array The form inptu fields as renderable array.

1 call to EntityViewDisplayAlterer::getSettingsInputsFromSettings()
EntityViewDisplayAlterer::addSmartTitle in src/EntityViewDisplayAlterer.php
Adds Smart Title to the entity form.

File

src/EntityViewDisplayAlterer.php, line 394

Class

EntityViewDisplayAlterer
Entity view display form alterer class for Smart Title.

Namespace

Drupal\smart_title

Code

protected function getSettingsInputsFromSettings(array $smart_title_settings, EntityViewDisplayInterface $entity) {
  return [
    'smart_title__tag' => [
      '#type' => 'select',
      '#title' => _smart_title_defaults('', NULL, 'smart_title__tag')['label'],
      '#options' => _smart_title_tag_options(),
      '#default_value' => $smart_title_settings['smart_title__tag'],
      '#empty_value' => '',
    ],
    'smart_title__classes' => [
      '#type' => 'textfield',
      '#title' => _smart_title_defaults('', NULL, 'smart_title__classes')['label'],
      '#default_value' => implode(' ', $smart_title_settings['smart_title__classes']),
      '#states' => [
        'invisible' => [
          ':input[name="fields[smart_title][settings_edit_form][settings][smart_title__tag]"]' => [
            'value' => '',
          ],
        ],
      ],
    ],
    'smart_title__link' => [
      '#type' => 'checkbox',
      '#title' => _smart_title_defaults('', NULL, 'smart_title__link')['label'],
      '#default_value' => $smart_title_settings['smart_title__link'],
    ],
  ];
}