Chris@0: actionManager = $action_manager; Chris@0: } Chris@0: Chris@0: /** Chris@0: * {@inheritdoc} Chris@0: */ Chris@0: public static function create(ContainerInterface $container) { Chris@0: return new static( Chris@0: $container->get('entity.manager')->getStorage('action'), Chris@0: $container->get('plugin.manager.action') Chris@0: ); Chris@0: } Chris@0: Chris@0: /** Chris@0: * {@inheritdoc} Chris@0: * Chris@0: * @param string $action_id Chris@0: * The hashed version of the action ID. Chris@0: */ Chris@0: public function buildForm(array $form, FormStateInterface $form_state, $action_id = NULL) { Chris@0: // In \Drupal\action\Form\ActionAdminManageForm::buildForm() the action Chris@0: // are hashed. Here we have to decrypt it to find the desired action ID. Chris@0: foreach ($this->actionManager->getDefinitions() as $id => $definition) { Chris@0: $key = Crypt::hashBase64($id); Chris@0: if ($key === $action_id) { Chris@0: $this->entity->setPlugin($id); Chris@0: // Derive the label and type from the action definition. Chris@0: $this->entity->set('label', $definition['label']); Chris@0: $this->entity->set('type', $definition['type']); Chris@0: break; Chris@0: } Chris@0: } Chris@0: Chris@0: return parent::buildForm($form, $form_state); Chris@0: } Chris@0: Chris@0: }