public static function MultiStepDisplay::removeItemSubmit in Entity Browser 8.2
Same name and namespace in other branches
- 8 src/Plugin/EntityBrowser/SelectionDisplay/MultiStepDisplay.php \Drupal\entity_browser\Plugin\EntityBrowser\SelectionDisplay\MultiStepDisplay::removeItemSubmit()
Submit callback for remove buttons.
Parameters
array $form: Form.
\Drupal\Core\Form\FormStateInterface $form_state: Form state.
File
- src/
Plugin/ EntityBrowser/ SelectionDisplay/ MultiStepDisplay.php, line 364
Class
- MultiStepDisplay
- Show current selection and delivers selected entities.
Namespace
Drupal\entity_browser\Plugin\EntityBrowser\SelectionDisplayCode
public static function removeItemSubmit(array &$form, FormStateInterface $form_state) {
$triggering_element = $form_state
->getTriggeringElement();
// Remove weight of entity being removed.
$form_state
->unsetValue([
'selected',
$triggering_element['#attributes']['data-remove-entity'] . '_' . $triggering_element['#attributes']['data-row-id'],
]);
// Remove entity itself.
$selected_entities =& $form_state
->get([
'entity_browser',
'selected_entities',
]);
unset($selected_entities[$triggering_element['#attributes']['data-row-id']]);
static::saveNewOrder($form_state);
$form_state
->setRebuild();
}