Skip to content

Commit

Permalink
FIX: Remove additional workflows if the set is empty.
Browse files Browse the repository at this point in the history
  • Loading branch information
frankmullenger committed May 26, 2016
1 parent 9a1723c commit fd0e13d
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions code/extensions/WorkflowApplicable.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,9 @@ public function updateCMSActions(FieldList $actions) {
}
}

// $action = FormAction::create('updateworkflow', $active->CurrentAction() ? $active->CurrentAction()->Title : _t('WorkflowApplicable.UPDATE_WORKFLOW', 'Update Workflow'))
// ->setAttribute('data-icon', 'navigation');
// $actions->fieldByName('MajorActions') ? $actions->fieldByName('MajorActions')->push($action) : $actions->push($action);
// $action = FormAction::create('updateworkflow', $active->CurrentAction() ? $active->CurrentAction()->Title : _t('WorkflowApplicable.UPDATE_WORKFLOW', 'Update Workflow'))
// ->setAttribute('data-icon', 'navigation');
// $actions->fieldByName('MajorActions') ? $actions->fieldByName('MajorActions')->push($action) : $actions->push($action);
}
} else {
// Instantiate the workflow definition initial actions.
Expand All @@ -181,7 +181,6 @@ public function updateCMSActions(FieldList $actions) {
$tab = Tab::create(
'AdditionalWorkflows'
);
$menu->insertBefore($tab, 'MoreOptions');
$addedFirst = false;
foreach($definitions as $definition) {
if($definition->getInitialAction()) {
Expand All @@ -191,7 +190,6 @@ public function updateCMSActions(FieldList $actions) {
)->addExtraClass('start-workflow')->setAttribute('data-workflow', $definition->ID);

// The first element is the main workflow definition, and will be displayed as a major action.

if(!$addedFirst) {
$addedFirst = true;
$action->setAttribute('data-icon', 'navigation');
Expand All @@ -202,8 +200,11 @@ public function updateCMSActions(FieldList $actions) {
}
}
}
// Only display menu if actions pushed to it
if ($tab->Fields()->exists()) {
$menu->insertBefore($tab, 'MoreOptions');
}
}

}
}
}
Expand Down

0 comments on commit fd0e13d

Please sign in to comment.