protected function EntityQueueForm::getHandlerPlugin in Entityqueue 8
Gets the handler plugin for the currently selected queue handler.
Parameters
\Drupal\entityqueue\EntityQueueInterface $entity: The current form entity.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Return value
\Drupal\entityqueue\EntityQueueHandlerInterface The queue handler plugin.
3 calls to EntityQueueForm::getHandlerPlugin()
- EntityQueueForm::form in src/
Form/ EntityQueueForm.php - Gets the actual form array to be built.
- EntityQueueForm::submitForm in src/
Form/ EntityQueueForm.php - Overrides \Drupal\field_ui\Form\EntityDisplayFormBase::submitForm().
- EntityQueueForm::validateForm in src/
Form/ EntityQueueForm.php - Form validation handler.
File
- src/
Form/ EntityQueueForm.php, line 315
Class
- EntityQueueForm
- Base form for entity queue edit forms.
Namespace
Drupal\entityqueue\FormCode
protected function getHandlerPlugin(EntityQueueInterface $entity, FormStateInterface $form_state) {
if (!($handler_plugin = $form_state
->get('handler_plugin'))) {
$stored_handler_id = $entity
->getHandler();
// Use selected handler if it exists, falling back to the stored handler.
$handler_id = $form_state
->getValue('handler', $stored_handler_id);
// If the current handler is the stored handler, use the stored handler
// settings. Otherwise leave the settings empty.
$handler_configuration = $handler_id === $stored_handler_id ? $entity
->getHandlerConfiguration() : [];
$handler_plugin = $this->entityQueueHandlerManager
->createInstance($handler_id, $handler_configuration);
$handler_plugin
->setQueue($entity);
$form_state
->set('handler_plugin', $handler_plugin);
}
return $handler_plugin;
}