Skip to content
Snippets Groups Projects
Commit 9035805a authored by John Voskuilen's avatar John Voskuilen
Browse files

Issue #2919482: Clean code

parent 33b8f079
No related branches found
No related tags found
No related merge requests found
Pipeline #113877 canceled
......@@ -5,7 +5,7 @@ namespace Drupal\workflow\Plugin\Validation\Constraint;
use Drupal\Core\Entity\Plugin\Validation\Constraint\CompositeConstraintBase;
/**
* Supports validating Workflow Field names.
* Supports validating Workflow field names.
*
* @see https://drupalwatchdog.com/volume-5/issue-2/introducing-drupal-8s-entity-validation-api
*
......
......@@ -208,7 +208,7 @@ class WorkflowStateListBuilder extends DraggableListBuilder {
$form['entities']['#prefix'] = '<div id="states_table_wrapper">';
$form['entities']['#suffix'] = '</div>';
// Add an emoty WorkflowState (It must NOT be saved to DB)to the list.
// Add an empty WorkflowState (It must NOT be saved to DB) to the list.
if ($form_state->getTriggeringElement()['#name'] ?? '' === 'add_state') {
$sid = '';
$placeholder = $workflow->createState($sid, FALSE);
......
......@@ -126,9 +126,7 @@ function hook_workflow($op, WorkflowTransitionInterface $transition, UserInterfa
return TRUE;
case 'transition post':
// In D7, this is called by Workflow Node during update of the state, directly
// after updating the Workflow. Workflow Field does not call this,
// since you can call a hook_entity_* event after saving the entity.
// This is a duplicate of D8 hook_entity_* event after saving the entity.
// @see https://api.drupal.org/api/drupal/includes%21module.inc/group/hooks/7
// workflow_debug(__FILE__, __FUNCTION__, __LINE__, $op, '');
$user = $transition->getOwner();
......@@ -270,7 +268,7 @@ function hook_field_widget_single_element_workflow_default_form_alter(&$element,
// An example of customizing/overriding the workflow widget.
// Beware, until now, you must do this twice: on the widget and on the form.
$uid = $transition->getOwnerId();
if ($uid == 1) {
if ($uid == 10) {
\Drupal::messenger()->addWarning('(Test/Devel message) For you, user 1,
the scheduling is disabled, and commenting is required.');
// Let us prohibit scheduling for user 1.
......@@ -303,7 +301,7 @@ function hook_form_workflow_transition_form_alter(&$form, FormStateInterface $fo
// An example of customizing/overriding the workflow widget.
// Beware, until now, you must do this twice: on the widget and on the form.
$uid = $transition->getOwnerId();
if ($uid == 1) {
if ($uid == 10) {
\Drupal::messenger()->addWarning('(Test/Devel message) For you, user 1,
the scheduling is disabled, and commenting is required.');
// Let us prohibit scheduling for user 1.
......
......@@ -91,7 +91,7 @@ function workflow_entity_delete(EntityInterface $entity) {
switch (TRUE) {
case $entity::class == 'Drupal\field\Entity\FieldConfig':
case $entity::class == 'Drupal\field\Entity\FieldStorageConfig':
// A Workflow Field is removed from an entity.
// A Workflow field is removed from an entity.
// @todo Test; use deleteTransitionsOfEntity().
$field_config = $entity;
/** @var \Drupal\Core\Entity\ContentEntityBase $field_config */
......
......@@ -14,7 +14,7 @@ function workflow_install() {
$url = Url::fromRoute('user.admin_permissions', [],
['fragment' => 'module-workflow']);
$message = t("Thanks for using Workflow module.
To start using a Workflow, add a Workflow Field to your entity.
To start using a Workflow, add a Workflow State field to your entity.
Please review which roles may 'participate in workflows'
<a href=':url'>on the Permissions page</a>.",
[':url' => $url->toString()]);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment