Skip to content

Commit 95bd347

Browse files
committed
added workflow id from model in both frontend and backend
1 parent 23a288c commit 95bd347

File tree

6 files changed

+18
-9
lines changed

6 files changed

+18
-9
lines changed

administrator/components/com_content/src/Model/ArticleModel.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,11 @@ public function getItem($pk = null)
404404
if (!empty($item->id)) {
405405
$item->tags = new TagsHelper();
406406
$item->tags->getTagIds($item->id, 'com_content.article');
407+
$workflow_assoc = $this->workflow->getAssociation($item->id);
408+
409+
if (!empty($workflow_assoc->workflow_id)) {
410+
$item->workflow_id = $workflow_assoc->workflow_id;
411+
}
407412

408413
$item->featured_up = null;
409414
$item->featured_down = null;

administrator/components/com_content/tmpl/article/edit.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
$fieldsetsInLinks = ['linka', 'linkb', 'linkc'];
3434
$this->ignore_fieldsets = array_merge(['jmetadata', 'item_associations'], $fieldsetsInImages, $fieldsetsInLinks);
3535
$this->useCoreUI = true;
36+
$this->workflow_id = $this->item->workflow_id;
3637

3738
// Create shortcut to parameters.
3839
$params = clone $this->state->get('params');
@@ -182,3 +183,4 @@
182183
<?php echo $this->form->renderControlFields(); ?>
183184
</div>
184185
</form>
186+
<?php echo LayoutHelper::render('joomla.workflow.graphmodal', $this); ?>

components/com_content/src/Model/FormModel.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,12 @@ public function getItem($itemId = null)
177177
}
178178
}
179179

180+
$workflow_assoc = $this->workflow->getAssociation($value->id);
181+
182+
if (!empty($workflow_assoc->workflow_id)) {
183+
$value->workflow_id = $workflow_assoc->workflow_id;
184+
}
185+
180186
return $value;
181187
}
182188

components/com_content/tmpl/form/edit.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
$this->tab_name = 'com-content-form';
2727
$this->ignore_fieldsets = ['image-intro', 'image-full', 'jmetadata', 'item_associations'];
2828
$this->useCoreUI = true;
29+
$this->workflow_id = $this->item->workflow_id;
2930

3031
// Create shortcut to parameters.
3132
$params = $this->state->get('params');
@@ -105,7 +106,7 @@
105106
<div class="w-100">
106107
<?php echo $this->form->renderField('transition'); ?>
107108
</div>
108-
<?php echo LayoutHelper::render('joomla.workflow.workflowgraphbtn', $this); ?>
109+
<?php echo LayoutHelper::render('joomla.workflow.workflowgraphbtn', $this->item); ?>
109110
</div>
110111
<?php echo $this->form->renderField('state'); ?>
111112
<?php echo $this->form->renderField('catid'); ?>

layouts/joomla/edit/article_options.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
'tags',
4646
'note',
4747
'version_note',
48-
];
48+
];
4949

5050
$hiddenFields = $displayData->get('hidden_fields') ?? [];
5151

@@ -88,4 +88,3 @@
8888
$html[] = '</fieldset>';
8989

9090
echo implode('', $html);
91-
echo LayoutHelper::render('joomla.workflow.graphmodal', $displayData);

layouts/joomla/workflow/graphmodal.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,15 @@
33

44

55
use Joomla\CMS\Factory;
6-
use Joomla\CMS\Language\Text;
76

87
$app = Factory::getApplication();
98
$wa = $app->getDocument()->getWebAssetManager();
10-
$registry = $app->getUserState('registry');
11-
$wa->getRegistry()->addExtensionRegistryFile('com_workflow');
12-
// add transitions registry
13-
$wa->getRegistry()->addExtensionRegistryFile('com_workflow.transitions');
149

10+
$wa->getRegistry()->addExtensionRegistryFile('com_workflow');
1511
$wa->useStyle('com_workflow.workflowgraphclient');
1612
$script = $wa->getAsset('script', name: 'com_workflow.workflowgraphclient')->getUri(true);
1713

18-
$workflowId = $app->getUserState('com_workflow.transitions.filter.workflow_id', 0);
14+
$workflowId = $displayData->workflow_id;
1915
?>
2016
<template id="workflow-graph-modal-content">
2117

0 commit comments

Comments
 (0)