You are here

protected function ParagraphViewModeWidget::getViewModesFieldDescription in Paragraph View Mode 2.x

Same name and namespace in other branches
  1. 8 src/Plugin/Field/FieldWidget/ParagraphViewModeWidget.php \Drupal\paragraph_view_mode\Plugin\Field\FieldWidget\ParagraphViewModeWidget::getViewModesFieldDescription()

Getter for 'view modes' field description.

Return value

\Drupal\Core\StringTranslation\TranslatableMarkup Field description.

1 call to ParagraphViewModeWidget::getViewModesFieldDescription()
ParagraphViewModeWidget::settingsForm in src/Plugin/Field/FieldWidget/ParagraphViewModeWidget.php
Returns a form to configure settings for the widget.

File

src/Plugin/Field/FieldWidget/ParagraphViewModeWidget.php, line 215

Class

ParagraphViewModeWidget
Plugin implementation of the 'paragraph_view_mode' widget.

Namespace

Drupal\paragraph_view_mode\Plugin\Field\FieldWidget

Code

protected function getViewModesFieldDescription() : TranslatableMarkup {
  $paragraphs_type = self::getParagraphsTypeFromRequest($this->request);
  $url_route = implode('.', [
    'entity.entity_view_display',
    StorageManagerInterface::ENTITY_TYPE,
    ViewModeInterface::DEFAULT,
  ]);
  $url_paramters = [
    'paragraphs_type' => $paragraphs_type
      ->id(),
  ];
  $url_options = [
    'fragment' => 'edit-modes',
  ];
  $url = Url::fromRoute($url_route, $url_paramters, $url_options);
  return $this
    ->t('It is using only the view modes enabled in the <strong>CUSTOM DISPLAY SETTINGS</strong> section under the <a href="@url">Manage Display</a> tab.', [
    '@url' => $url
      ->toString(),
  ]);
}