Skip to content

Commit

Permalink
[4.2] Workflow Transitions
Browse files Browse the repository at this point in the history
Recently there have been several people posting that they don't understand Workflows. I was reviewing my notes from the Workflows presentation I gave this year at JoomlaDay fr and I realised that we can easily remove one area of confusion.
  • Loading branch information
brianteeman committed Nov 28, 2022
1 parent 1fc0330 commit 0e240a8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
1 change: 1 addition & 0 deletions administrator/language/en-GB/com_content.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down
5 changes: 3 additions & 2 deletions layouts/joomla/button/transition-button.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,11 @@
<?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 ?? '',
Expand Down
6 changes: 4 additions & 2 deletions libraries/src/Form/Field/TransitionField.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,15 +161,17 @@ function ($item) use ($user, $component) {

$workflowName = $db->setQuery($query)->loadResult();

$default = [HTMLHelper::_('select.option', '', Text::_($workflowName))];
$default = [
HTMLHelper::_('select.option', '', Text::_($workflowName))];

$options = array_merge(parent::getOptions(), $items);

if (\count($options)) {
$default[] = HTMLHelper::_('select.option', '-1', '--------', ['disable' => true]);
$default[] = HTMLHelper::_('select.option', '<OPTGROUP>', Text::_('COM_CONTENT_RUN_TRANSITION'));
}

// Merge with defaults
return array_merge($default, $options);
return array_merge($default, $options, [HTMLHelper::_('select.option', '</OPTGROUP>')]);
}
}

0 comments on commit 0e240a8

Please sign in to comment.