class ParagraphBlocksInlineParagraphsWidget in Paragraph blocks 3.x
Same name and namespace in other branches
- 8.2 src/Plugin/Field/FieldWidget/ParagraphBlocksInlineParagraphsWidget.php \Drupal\paragraph_blocks\Plugin\Field\FieldWidget\ParagraphBlocksInlineParagraphsWidget
- 8 src/Plugin/Field/FieldWidget/ParagraphBlocksInlineParagraphsWidget.php \Drupal\paragraph_blocks\Plugin\Field\FieldWidget\ParagraphBlocksInlineParagraphsWidget
Extend the inline paragraphs widget.
Used to change the summary display to the admin title; and to hide the admin title on embedded paragraphs (paragraphs within paragraphs). Only top level paragraphs use the admin title.
Hierarchy
- class \Drupal\paragraph_blocks\Plugin\Field\FieldWidget\ParagraphBlocksInlineParagraphsWidget extends \Drupal\paragraphs\Plugin\Field\FieldWidget\InlineParagraphsWidget
Expanded class hierarchy of ParagraphBlocksInlineParagraphsWidget
1 file declares its use of ParagraphBlocksInlineParagraphsWidget
File
- src/
Plugin/ Field/ FieldWidget/ ParagraphBlocksInlineParagraphsWidget.php, line 16
Namespace
Drupal\paragraph_blocks\Plugin\Field\FieldWidgetView source
class ParagraphBlocksInlineParagraphsWidget extends InlineParagraphsWidget {
/**
* {@inheritdoc}
*/
public function formElement(FieldItemListInterface $items, $delta, array $element, array &$form, FormStateInterface $form_state) {
$element = parent::formElement($items, $delta, $element, $form, $form_state);
// Hide admin_label when this is not a top level paragraph. It is not a
// top level paragraph if there are multiple subforms.
$subform =& $element['subform'];
if (isset($subform['#parents']) && count(array_intersect($subform['#parents'], [
'subform',
])) > 1) {
$subform['admin_title']['#access'] = FALSE;
}
return $element;
}
}