Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@

use Joomla\CMS\Factory;
use Joomla\CMS\Layout\LayoutHelper;
use Joomla\CMS\Component\ComponentHelper;

$params = ComponentHelper::getParams('com_content');

$published = $this->state->get('filter.published');

Expand Down Expand Up @@ -42,7 +45,7 @@
<?php echo LayoutHelper::render('joomla.html.batch.tag', []); ?>
</div>
</div>
<?php if ($user->authorise('core.admin', 'com_content')) : ?>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that's the wrong approach, you should ask the service if the workflow is enabled for this view. Also as example for other developer

<?php if ($user->authorise('core.admin', 'com_content') && $params->get('workflows_enable', 1)) : ?>
<div class="form-group col-md-6">
<div class="controls">
<?php echo LayoutHelper::render('joomla.html.batch.workflowstage', ['extension' => 'com_content']); ?>
Expand Down
8 changes: 4 additions & 4 deletions libraries/src/MVC/Model/WorkflowBehaviorTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -417,10 +417,10 @@ protected function getStageForNewItem(Form $form, $data)
*
* @since 4.0.0
*/
public function batchWorkflowStage(int $value, array $pks, array $contexts) {

public function batchWorkflowStage(int $value, array $pks, array $contexts)
{
$user = Factory::getApplication()->getIdentity();
/** @var $workflow */

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't there be the class name?


$workflow = Factory::getApplication()->bootComponent('com_workflow');

if (!$user->authorise('core.admin', $this->option))
Expand All @@ -429,7 +429,7 @@ public function batchWorkflowStage(int $value, array $pks, array $contexts) {
}

// Get workflow stage information
$stage = $workflow->createTable('Stage', 'Administrator');
$stage = $workflow->getMVCFactory()->createTable('Stage', 'Administrator');

if (empty($value) || !$stage->load($value))
{
Expand Down