You are here

public function BlazyEntityReferenceBase::settingsForm in Blazy 8

Same name and namespace in other branches
  1. 8.2 src/Dejavu/BlazyEntityReferenceBase.php \Drupal\blazy\Dejavu\BlazyEntityReferenceBase::settingsForm()

Returns a form to configure settings for the formatter.

Invoked from \Drupal\field_ui\Form\EntityDisplayFormBase to allow administrators to configure the formatter. The field_ui module takes care of handling submitted form values.

Parameters

array $form: The form where the settings form is being included in.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Return value

array The form elements for the formatter settings.

Overrides BlazyEntityBase::settingsForm

File

src/Dejavu/BlazyEntityReferenceBase.php, line 204

Class

BlazyEntityReferenceBase
Base class for entity reference formatters with field details.

Namespace

Drupal\blazy\Dejavu

Code

public function settingsForm(array $form, FormStateInterface $form_state) {
  $element = parent::settingsForm($form, $form_state);
  if (isset($element['layout'])) {
    $layout_description = $element['layout']['#description'];
    $element['layout']['#description'] = $this
      ->t('Create a dedicated List (text - max number 1) field related to the caption placement to have unique layout per slide with the following supported keys: top, right, bottom, left, center, center-top, etc. Be sure its formatter is Key.') . ' ' . $layout_description;
  }
  if (isset($element['media_switch'])) {
    $element['media_switch']['#options']['rendered'] = $this
      ->t('Image rendered by its formatter');
    $element['media_switch']['#description'] .= ' ' . $this
      ->t('Be sure the enabled fields here are not hidden/disabled at its view mode.');
  }
  if (isset($element['caption'])) {
    $element['caption']['#description'] = $this
      ->t('Check fields to be treated as captions, even if not caption texts.');
  }
  if (isset($element['image']['#description'])) {
    $element['image']['#description'] .= ' ' . $this
      ->t('For video, this allows separate highres image, be sure the same field used for Image to have a mix of videos and images. Leave empty to fallback to the video provider thumbnails. The formatter/renderer is managed by <strong>@namespace</strong> formatter. Meaning original formatter ignored. If you want original formatters, check <strong>Vanilla</strong> option. Alternatively choose <strong>Media switcher &gt; Image rendered </strong>, other image-related settings here will be ignored. <strong>Supported fields</strong>: Image, Video Embed Field.', [
      '@namespace' => $this
        ->getPluginId(),
    ]);
  }
  if (isset($element['overlay']['#description'])) {
    $element['overlay']['#description'] .= ' ' . $this
      ->t('The formatter/renderer is managed by the child formatter. <strong>Supported fields</strong>: Image, Video Embed Field, Media Entity.');
  }
  return $element;
}