JoomlaPolska / jezyk-J4

Język polski dla Joomla 4
GNU General Public License v2.0
3 stars 5 forks source link

[4.3] Workflow Transitions #288

Closed joomlapl-bot closed 1 year ago

joomlapl-bot commented 1 year ago

PR w związku ze zmianą oryginału https://github.com/joomla/joomla-cms/pull/39325 Poniżej zmiany w oryginale:

Click to expand the diff! ```diff diff --git a/administrator/language/en-GB/com_content.ini b/administrator/language/en-GB/com_content.ini index 125930cfacfd..aa6df5a8776b 100644 --- a/administrator/language/en-GB/com_content.ini +++ b/administrator/language/en-GB/com_content.ini @@ -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." diff --git a/layouts/joomla/button/transition-button.php b/layouts/joomla/button/transition-button.php index 502815a29419..60f09fda7597 100644 --- a/layouts/joomla/button/transition-button.php +++ b/layouts/joomla/button/transition-button.php @@ -58,10 +58,11 @@ escape($options['title'])), - HTMLHelper::_('select.option', '-1', '--------', ['disable' => true]) + HTMLHelper::_('select.option', '-1', '--------', ['disable' => true]), + HTMLHelper::_('select.option', '', Text::_('COM_CONTENT_RUN_TRANSITION')), ]; - $transitions = array_merge($default, $options['transitions']); + $transitions = array_merge($default, $options['transitions'], [HTMLHelper::_('select.option', '')]); $attribs = [ 'id' => 'transition-select_' . (int) $row ?? '', diff --git a/libraries/src/Form/Field/TransitionField.php b/libraries/src/Form/Field/TransitionField.php index 4c0ae25eed3a..03e8396490bf 100644 --- a/libraries/src/Form/Field/TransitionField.php +++ b/libraries/src/Form/Field/TransitionField.php @@ -19,11 +19,11 @@ // 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 @@ public function setup(\SimpleXMLElement $element, $value, $group = null) * * @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 @@ 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); + $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); } } diff --git a/libraries/src/MVC/Model/WorkflowBehaviorTrait.php b/libraries/src/MVC/Model/WorkflowBehaviorTrait.php index cdf0967b6a5b..d5443c8c771e 100644 --- a/libraries/src/MVC/Model/WorkflowBehaviorTrait.php +++ b/libraries/src/MVC/Model/WorkflowBehaviorTrait.php @@ -330,7 +330,7 @@ protected function addTransitionField(Form $form, $data) $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); ```