mirror of
https://github.com/joomla/joomla-cms.git
synced 2024-06-20 19:15:27 +00:00
[4.3] Workflow Transitions (#39325)
This commit is contained in:
parent
d08fbac65a
commit
3a115086ed
|
@ -160,6 +160,7 @@ COM_CONTENT_PUBLISH_DOWN_DESC="Finish Publishing descending"
|
|||
COM_CONTENT_PUBLISH_UP_ASC="Start Publishing ascending"
|
||||
COM_CONTENT_PUBLISH_UP_DESC="Start Publishing descending"
|
||||
COM_CONTENT_PUBLISHED="Published"
|
||||
COM_CONTENT_RUN_TRANSITION="Run Transition"
|
||||
COM_CONTENT_RUN_TRANSITIONS="Run Transitions"
|
||||
COM_CONTENT_SAVE_SUCCESS="Article saved."
|
||||
COM_CONTENT_SAVE_WARNING="Alias already existed so a number was added at the end. You can re-edit the article to customise the alias."
|
||||
|
@ -190,6 +191,7 @@ COM_CONTENT_URL_FIELD_C_BROWSERNAV_LABEL="URL C Target Window"
|
|||
COM_CONTENT_WARNING_PROVIDE_VALID_NAME="Please provide a valid, non-blank title."
|
||||
COM_CONTENT_WORKFLOW="Workflow"
|
||||
COM_CONTENT_WORKFLOW_NOT_FOUND="No default workflow available, please define one or contact an administrator."
|
||||
COM_CONTENT_WORKFLOW_STAGE="Workflow Stage"
|
||||
COM_CONTENT_WORKFLOW_TRANSITION_NOT_ALLOWED="You're not allowed to execute this transition"
|
||||
COM_CONTENT_WORKFLOWS="Workflows"
|
||||
COM_CONTENT_XML_DESCRIPTION="Article management component."
|
||||
|
|
|
@ -58,10 +58,11 @@ $task = $options['task'];
|
|||
<?php
|
||||
$default = [
|
||||
HTMLHelper::_('select.option', '', $this->escape($options['title'])),
|
||||
HTMLHelper::_('select.option', '-1', '--------', ['disable' => true])
|
||||
HTMLHelper::_('select.option', '-1', '--------', ['disable' => true]),
|
||||
HTMLHelper::_('select.option', '<OPTGROUP>', Text::_('COM_CONTENT_RUN_TRANSITION')),
|
||||
];
|
||||
|
||||
$transitions = array_merge($default, $options['transitions']);
|
||||
$transitions = array_merge($default, $options['transitions'], [HTMLHelper::_('select.option', '</OPTGROUP>')]);
|
||||
|
||||
$attribs = [
|
||||
'id' => 'transition-select_' . (int) $row ?? '',
|
||||
|
|
|
@ -19,11 +19,11 @@ use Joomla\Database\ParameterType;
|
|||
// phpcs:enable PSR1.Files.SideEffects
|
||||
|
||||
/**
|
||||
* Components Category field.
|
||||
* Workflow Transitions field.
|
||||
*
|
||||
* @since 4.0.0
|
||||
*/
|
||||
class TransitionField extends ListField
|
||||
class TransitionField extends GroupedlistField
|
||||
{
|
||||
/**
|
||||
* The form field type.
|
||||
|
@ -91,7 +91,7 @@ class TransitionField extends ListField
|
|||
*
|
||||
* @since 4.0.0
|
||||
*/
|
||||
protected function getOptions()
|
||||
protected function getGroups()
|
||||
{
|
||||
// Let's get the id for the current item, either category or content item.
|
||||
$jinput = Factory::getApplication()->getInput();
|
||||
|
@ -161,15 +161,20 @@ class TransitionField extends ListField
|
|||
|
||||
$workflowName = $db->setQuery($query)->loadResult();
|
||||
|
||||
$default = [HTMLHelper::_('select.option', '', Text::_($workflowName))];
|
||||
$default = [[
|
||||
HTMLHelper::_('select.option', '', Text::_($workflowName))]];
|
||||
|
||||
$options = array_merge(parent::getOptions(), $items);
|
||||
$groups = parent::getGroups();
|
||||
|
||||
if (\count($options)) {
|
||||
$default[] = HTMLHelper::_('select.option', '-1', '--------', ['disable' => true]);
|
||||
if (\count($items)) {
|
||||
$groups[Text::_('COM_CONTENT_RUN_TRANSITION')] = $items;
|
||||
}
|
||||
|
||||
if (\count($groups)) {
|
||||
$default[][] = HTMLHelper::_('select.option', '-1', '--------', ['disable' => true]);
|
||||
}
|
||||
|
||||
// Merge with defaults
|
||||
return array_merge($default, $options);
|
||||
return array_merge($default, $groups);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -330,7 +330,7 @@ trait WorkflowBehaviorTrait
|
|||
|
||||
$field->addAttribute('name', 'transition');
|
||||
$field->addAttribute('type', $this->workflowEnabled ? 'transition' : 'hidden');
|
||||
$field->addAttribute('label', 'COM_CONTENT_WORKFLOW');
|
||||
$field->addAttribute('label', 'COM_CONTENT_WORKFLOW_STAGE');
|
||||
$field->addAttribute('extension', $extension);
|
||||
|
||||
$form->setField($field);
|
||||
|
|
Loading…
Reference in New Issue
Block a user