public function WorkflowState::showWidget in Workflow 7.2
Determines if the Workflow Form must be shown.
If not, a formatter must be shown, since there are no valid options.
Parameters
$entity_type:
$entity:
$field_name:
$user:
$force:
Return value
bool $show_widget TRUE = a form (a.k.a. widget) must be shown; FALSE = no form, a formatter must be shown instead.
File
- includes/
Entity/ WorkflowState.php, line 301 - Contains workflow\includes\Entity\WorkflowState. Contains workflow\includes\Entity\WorkflowStateController.
Class
- WorkflowState
- Class WorkflowState
Code
public function showWidget($entity_type, $entity, $field_name, $user, $force) {
$options = $this
->getOptions($entity_type, $entity, $field_name, $user, $force);
$count = count($options);
// The easiest case first: more then one option: always show form.
if ($count > 1) {
return TRUE;
}
// #2226451: Even in Creation state, we must have 2 visible states to show the widget.
// // Only when in creation phase, one option is sufficient,
// // since the '(creation)' option is not included in $options.
// // When in creation state,
// if ($this->isCreationState()) {
// return TRUE;
// }
return FALSE;
}