function _thunder_paragraph_attach_ief_submit in Thunder 8.3
Same name and namespace in other branches
- 8.5 modules/thunder_paragraphs/thunder_paragraphs.module \_thunder_paragraph_attach_ief_submit()
- 8.2 modules/thunder_paragraphs/thunder_paragraphs.module \_thunder_paragraph_attach_ief_submit()
- 8.4 modules/thunder_paragraphs/thunder_paragraphs.module \_thunder_paragraph_attach_ief_submit()
- 6.2.x modules/thunder_paragraphs/thunder_paragraphs.module \_thunder_paragraph_attach_ief_submit()
- 6.0.x modules/thunder_paragraphs/thunder_paragraphs.module \_thunder_paragraph_attach_ief_submit()
- 6.1.x modules/thunder_paragraphs/thunder_paragraphs.module \_thunder_paragraph_attach_ief_submit()
Helper for attaching IEF submit trigger and functions.
Parameters
array $element: Element render array for paragraph.
array $button_parents: Array with parents for paragraph collapse button.
bool $is_displayed: Flag if "Collapse and save" button should be visible.
2 calls to _thunder_paragraph_attach_ief_submit()
- thunder_paragraphs_field_widget_entity_reference_paragraphs_form_alter in modules/
thunder_paragraphs/ thunder_paragraphs.module - Implements hook_field_widget_WIDGET_TYPE_form_alter().
- thunder_paragraphs_field_widget_paragraphs_form_alter in modules/
thunder_paragraphs/ thunder_paragraphs.module - Implements hook_field_widget_WIDGET_TYPE_form_alter().
File
- modules/
thunder_paragraphs/ thunder_paragraphs.module, line 103 - Contains paragraphs related hook implementations and functions.
Code
function _thunder_paragraph_attach_ief_submit(array &$element, array $button_parents, $is_displayed = TRUE) {
if (isset($element['subform'])) {
foreach (Element::children($element['subform']) as $index) {
if (isset($element['subform'][$index]['widget'][0]['inline_entity_form']) || isset($element['subform'][$index]['widget']['#ief_id']) || isset($element['subform'][$index]['widget']['#attach_ief_submit'])) {
$button = NestedArray::getValue($element, $button_parents);
if ($button) {
$button['#submit'] = array_merge([
[
'Drupal\\inline_entity_form\\ElementSubmit',
'trigger',
],
], $button['#submit']);
$button['#value'] = t('Collapse and save');
$button['#ief_submit_trigger'] = TRUE;
$button['#ief_submit_trigger_all'] = TRUE;
$button['#paragraphs_show_warning'] = FALSE;
$button['#access'] = $is_displayed;
NestedArray::setValue($element, $button_parents, $button);
}
}
}
}
}