Back to WorkflowPluginTrait class

Method enhanceWorkflowTransitionForm

protected bool
enhanceWorkflowTransitionForm
(\Joomla\CMS\Form\Form $form, mixed $data)
Add different parameter options to the transition view, we need when executing the transition
Parameters
  • \Joomla\CMS\Form\Form $form The form
  • \stdClass $data The data
Returns
  • bool
Since
  • 4.0.0

Method enhanceWorkflowTransitionForm - Source code

/**
 * Add different parameter options to the transition view, we need when executing the transition
 *
 * @param   Form      $form The form
 * @param   \stdClass $data The data
 *
 * @return  boolean
 *
 * @since   4.0.0
 */
protected function enhanceWorkflowTransitionForm(Form $form, $data)
{
    $workflow_id = (int) ($data->workflow_id ?? $form->getValue('workflow_id'));
    $workflow = $this->getWorkflow($workflow_id);
    if (empty($workflow->id) || !$this->isSupported($workflow->extension)) {
        return false;
    }
    // Load XML file from "parent" plugin
    $path = dirname((new ReflectionClass(static::class))->getFileName());
    if (is_file($path . '/forms/action.xml')) {
        $form->loadFile($path . '/forms/action.xml');
    }
    return $workflow;
}