You are here

public function BlazyEntityMediaBase::settingsForm in Blazy 8.2

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

1 call to BlazyEntityMediaBase::settingsForm()
BlazyEntityReferenceBase::settingsForm in src/Dejavu/BlazyEntityReferenceBase.php
Returns a form to configure settings for the formatter.
1 method overrides BlazyEntityMediaBase::settingsForm()
BlazyEntityReferenceBase::settingsForm in src/Dejavu/BlazyEntityReferenceBase.php
Returns a form to configure settings for the formatter.

File

src/Dejavu/BlazyEntityMediaBase.php, line 178

Class

BlazyEntityMediaBase
Base class for Media 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['media_switch'])) {
    $element['media_switch']['#options']['rendered'] = $this
      ->t('Image rendered by its formatter');
    $element['media_switch']['#description'] .= ' ' . $this
      ->t('<b>Image rendered</b> requires <b>Image</b> option filled out and is useful if the formmater offers awesomeness that Blazy does not have but still wants Blazy for a Grid, etc. 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 (remote|local) video, this allows separate high-res or poster image. Be sure this exact same field is also used for bundle <b>Image</b> to have a mix of videos and images if this entity is Media. Leaving it empty will fallback to the video provider thumbnails, or no poster for local video. The formatter/renderer is managed by <strong>@plugin_id</strong> formatter. Meaning original formatter ignored.', [
      '@plugin_id' => $this
        ->getPluginId(),
    ]);
  }
  return $element;
}