function paragraphs_ee_paragraphs_ee_widget_access in Paragraphs Editor Enhancements 8
Implements hook_paragraphs_ee_widget_access().
File
- ./
paragraphs_ee.module, line 43 - Main functions for "Paragraphs Editor Enhancements" module.
Code
function paragraphs_ee_paragraphs_ee_widget_access(array $elements, FormStateInterface $form_state, array $context) {
/** @var \Drupal\paragraphs\Plugin\Field\FieldWidget\ParagraphsWidget $widget */
$widget = $context['widget'];
if (!$widget instanceof ParagraphsWidget || 'modal' !== $widget
->getSetting('add_mode')) {
return AccessResult::forbidden();
}
if (empty($elements['add_more']['#theme']) || 'paragraphs_add_dialog' !== $elements['add_more']['#theme']) {
return AccessResult::neutral('Do not override default theme implementation for "add-more" element.');
}
return AccessResult::allowed();
}