Skip to content

Commit

Permalink
Fixing codestyle (joomla#97)
Browse files Browse the repository at this point in the history
* Fixing system tests and codestyle

* Fixing Postgres

* Adding exclusion for canDelete for API calls

* Codestyle
  • Loading branch information
Hackwar authored and sakiss committed Oct 16, 2020
1 parent 3e4f927 commit c3f0ba5
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,8 @@ public function getForm($data = array(), $loadData = true)
$form->setFieldAttribute($field, 'filter', 'unset');
}

$where = $this->getDbo()->quoteName('workflow_id') . ' = ' . (int) $data['workflow_id'] . ' AND ' . $this->getDbo()->quoteName('published') . ' = 1';
$where = $this->getDbo()->quoteName('workflow_id') . ' = ' . (int) $data['workflow_id'];
$where .= ' AND ' . $this->getDbo()->quoteName('published') . ' = 1';

$form->setFieldAttribute('from_stage_id', 'sql_where', $where);
$form->setFieldAttribute('to_stage_id', 'sql_where', $where);
Expand Down
33 changes: 22 additions & 11 deletions libraries/src/Workflow/WorkflowPluginTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,20 @@
\defined('JPATH_PLATFORM') or die;

use Joomla\CMS\Form\Form;
use Joomla\CMS\Object\CMSObject;
use ReflectionClass;

/**
* Trait for component workflow plugins.
*
* @since 4.0.0
*/
trait WorkflowPluginTrait {

trait WorkflowPluginTrait
{
/**
* Add different parameter options to the transition view, we need when executing the transition
*
* @param Form $form The form
* @param Form $form The form
* @param \stdClass $data The data
*
* @return boolean
Expand Down Expand Up @@ -52,25 +53,35 @@ protected function enhanceWorkflowTransitionForm(Form $form, $data)
return $workflow;
}

protected function getWorkflow(int $workflow_id = null) {

/**
* Get the workflow for a given ID
*
* @param int|null $workflow_id ID of the workflow
*
* @return CMSObject|boolean Object on success, false on failure.
*
* @since __DEPLOY_VERSION__
*/
protected function getWorkflow(int $workflow_id = null)
{
$workflow_id = !empty($workflow_id) ? $workflow_id : $this->app->input->getInt('workflow_id');

if (is_array($workflow_id)) {
if (is_array($workflow_id))
{
return false;
}

return $this->app->bootComponent('com_workflow')
->getMVCFactory()
->createModel('Workflow', 'Administrator', ['ignore_request' => true])
->getItem($workflow_id);
->getMVCFactory()
->createModel('Workflow', 'Administrator', ['ignore_request' => true])
->getItem($workflow_id);
}


/**
* Check if the current plugin should execute workflow related activities
*
* @param string $context
* @param string $context Context to check
*
* @return boolean
*
* @since 4.0.0
Expand Down
7 changes: 6 additions & 1 deletion plugins/workflow/featuring/featuring.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,12 @@ protected function enhanceItemForm(Form $form, $data)

$form->setFieldAttribute($fieldname, 'type', 'spacer');

$form->setFieldAttribute($fieldname, 'label', Text::sprintf('PLG_WORKFLOW_FEATURING_FEATURED', '<span class="text-' . $textclass . '">' . htmlentities($text, ENT_COMPAT, 'UTF-8') . '</span>'));
$label = '<span class="text-' . $textclass . '">' . htmlentities($text, ENT_COMPAT, 'UTF-8') . '</span>';
$form->setFieldAttribute(
$fieldname,
'label',
Text::sprintf('PLG_WORKFLOW_FEATURING_FEATURED', $label)
);

return true;
}
Expand Down

0 comments on commit c3f0ba5

Please sign in to comment.