X-Git-Url: http://aleph1.co.uk/gitweb/?a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Fworkflows%2Fsrc%2FForm%2FWorkflowAddForm.php;h=19894691239b69d3c06c0c880afedeb55d14e3a0;hb=9917807b03b64faf00f6a1f29dcb6eafc454efa5;hp=56cbf699617659b53779af7a3038a6538633423a;hpb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;p=yaffs-website diff --git a/web/core/modules/workflows/src/Form/WorkflowAddForm.php b/web/core/modules/workflows/src/Form/WorkflowAddForm.php index 56cbf6996..198946912 100644 --- a/web/core/modules/workflows/src/Form/WorkflowAddForm.php +++ b/web/core/modules/workflows/src/Form/WorkflowAddForm.php @@ -53,7 +53,6 @@ class WorkflowAddForm extends EntityForm { '#title' => $this->t('Label'), '#maxlength' => 255, '#default_value' => $workflow->label(), - '#description' => $this->t('Label for the Workflow.'), '#required' => TRUE, ]; @@ -65,9 +64,8 @@ class WorkflowAddForm extends EntityForm { ], ]; - $workflow_types = array_map(function ($plugin_definition) { - return $plugin_definition['label']; - }, $this->workflowTypePluginManager->getDefinitions()); + $workflow_types = array_column($this->workflowTypePluginManager->getDefinitions(), 'label', 'id'); + $form['workflow_type'] = [ '#type' => 'select', '#title' => $this->t('Workflow type'), @@ -84,10 +82,8 @@ class WorkflowAddForm extends EntityForm { public function save(array $form, FormStateInterface $form_state) { /* @var \Drupal\workflows\WorkflowInterface $workflow */ $workflow = $this->entity; - // Initialize the workflow using the selected type plugin. - $workflow = $workflow->getTypePlugin()->initializeWorkflow($workflow); $return = $workflow->save(); - if (empty($workflow->getStates())) { + if (empty($workflow->getTypePlugin()->getStates())) { drupal_set_message($this->t('Created the %label Workflow. In order for the workflow to be enabled there needs to be at least one state.', [ '%label' => $workflow->label(), ]));