function _social_event_managers_get_action_id in Open Social 8.7
Same name and namespace in other branches
- 8.9 modules/social_features/social_event/modules/social_event_managers/social_event_managers.module \_social_event_managers_get_action_id()
- 8.5 modules/social_features/social_event/modules/social_event_managers/social_event_managers.module \_social_event_managers_get_action_id()
- 8.6 modules/social_features/social_event/modules/social_event_managers/social_event_managers.module \_social_event_managers_get_action_id()
- 8.8 modules/social_features/social_event/modules/social_event_managers/social_event_managers.module \_social_event_managers_get_action_id()
- 10.3.x modules/social_features/social_event/modules/social_event_managers/social_event_managers.module \_social_event_managers_get_action_id()
- 10.0.x modules/social_features/social_event/modules/social_event_managers/social_event_managers.module \_social_event_managers_get_action_id()
- 10.1.x modules/social_features/social_event/modules/social_event_managers/social_event_managers.module \_social_event_managers_get_action_id()
- 10.2.x modules/social_features/social_event/modules/social_event_managers/social_event_managers.module \_social_event_managers_get_action_id()
Function to get the action id of a batch.
Parameters
array $batch: The batch array.
Return value
string Returns the batch action id.
1 call to _social_event_managers_get_action_id()
- social_event_managers_batch_alter in modules/
social_features/ social_event/ modules/ social_event_managers/ social_event_managers.module - Implements hook_batch_alter().
File
- modules/
social_features/ social_event/ modules/ social_event_managers/ social_event_managers.module, line 488 - Contains social_event_managers.module.
Code
function _social_event_managers_get_action_id(array &$batch) {
/** @var \Drupal\Core\Form\FormStateInterface $form_state */
$form_state =& $batch['form_state'];
$action_id = '';
if ($form_state instanceof FormStateInterface) {
$data = $form_state
->get('views_bulk_operations');
$action_id = $data['action_id'];
}
else {
foreach ($batch['sets'][0]['operations'] as $operations) {
if (empty($operations) || !is_array($operations)) {
break;
}
foreach ($operations as $operation) {
if (empty($operation) || !is_array($operation)) {
break;
}
foreach ($operation as $items) {
if (empty($items) || !is_array($items)) {
break;
}
if (!empty($items['action_id'])) {
$action_id = $items['action_id'];
break;
}
}
}
}
}
return $action_id;
}