5 * Hooks and documentation related to paragraphs module.
14 * Alter the information provided in
15 * \Drupal\paragraphs\Annotation\ParagraphsBehavior.
17 * @param $paragraphs_behavior
18 * The array of paragraphs behavior plugins, keyed on the
19 * machine-readable plugin name.
21 function hook_paragraphs_behavior_info_alter(&$paragraphs_behavior) {
22 // Set a new label for the my_layout plugin instead of the one
23 // provided in the annotation.
24 $paragraphs_behavior['my_layout']['label'] = t('New label');
28 * Alter paragraphs widget.
30 * @param array $widget_actions
31 * Array with actions and dropdown widget actions.
32 * @param array $context
33 * An associative array containing the following key-value pairs:
34 * - form: The form structure to which widgets are being attached. This may be
35 * a full form structure, or a sub-element of a larger form.
36 * - widget: The widget plugin instance.
37 * - items: The field values, as a
38 * \Drupal\Core\Field\FieldItemListInterface object.
39 * - delta: The order of this item in the array of subelements (0, 1, 2, etc).
40 * - element: A form element array containing basic properties for the widget.
41 * - form_state: The current state of the form.
42 * - paragraphs_entity: the paragraphs entity for this widget. Might be
43 * unsaved, if we have just added a new item to the widget.
45 function hook_paragraphs_widget_actions_alter(array &$widget_actions, array &$context) {
49 * @} End of "addtogroup hooks".