public function ParagraphsOffCanvasBrowser::getTitle in Paragraphs Editor Enhancements 8
Generate the title for the off-canvas browser page.
1 string reference to 'ParagraphsOffCanvasBrowser::getTitle'
File
- src/
Controller/ ParagraphsOffCanvasBrowser.php, line 15
Class
- ParagraphsOffCanvasBrowser
- Controller for the Paragraphs off-canvas browser.
Namespace
Drupal\paragraphs_ee\ControllerCode
public function getTitle($entity_type, $bundle, $form_mode, $field_name) {
$title_default = $this
->t('Add Paragraph', [], [
'context' => 'Paragraphs Editor Enhancements',
]);
/** @var \Drupal\Core\Entity\Display\EntityFormDisplayInterface $form_display */
$form_display = $this
->entityTypeManager()
->getStorage('entity_form_display')
->load($entity_type . '.' . $bundle . '.' . $form_mode);
if (!$form_display) {
return $title_default;
}
$component = $form_display
->getComponent($field_name);
if (!$component || !isset($component['third_party_settings']['paragraphs_ee']['paragraphs_ee']['dialog_off_canvas']) || TRUE !== $component['third_party_settings']['paragraphs_ee']['paragraphs_ee']['dialog_off_canvas']) {
return $title_default;
}
return $this
->t('Add @widget_title', [
'@widget_title' => $component['settings']['title'],
], [
'context' => 'Paragraphs Editor Enhancements',
]);
}