Browse Source

updated i18n i10n_update workflwo imachecache_actions

Bachir Soussi Chiadmi 10 months ago
parent
commit
092758ecb0
100 changed files with 2305 additions and 994 deletions
  1. 28 35
      sites/all/modules/contrib/admin/workflow/includes/Entity/Workflow.php
  2. 29 4
      sites/all/modules/contrib/admin/workflow/includes/Entity/WorkflowConfigTransition.php
  3. 7 4
      sites/all/modules/contrib/admin/workflow/includes/Entity/WorkflowInterface.php
  4. 5 11
      sites/all/modules/contrib/admin/workflow/includes/Entity/WorkflowState.php
  5. 1 1
      sites/all/modules/contrib/admin/workflow/includes/Entity/WorkflowTransition.php
  6. 6 5
      sites/all/modules/contrib/admin/workflow/includes/Field/WorkflowItem.php
  7. 7 6
      sites/all/modules/contrib/admin/workflow/includes/Form/WorkflowTransitionForm.php
  8. 4 6
      sites/all/modules/contrib/admin/workflow/workflow.deprecated.inc
  9. 7 7
      sites/all/modules/contrib/admin/workflow/workflow.entity.inc
  10. 18 4
      sites/all/modules/contrib/admin/workflow/workflow.features.inc
  11. 4 5
      sites/all/modules/contrib/admin/workflow/workflow.info
  12. 9 2
      sites/all/modules/contrib/admin/workflow/workflow.install
  13. 12 5
      sites/all/modules/contrib/admin/workflow/workflow.module
  14. 2 2
      sites/all/modules/contrib/admin/workflow/workflow.pages.inc
  15. 2 2
      sites/all/modules/contrib/admin/workflow/workflow.tokens.inc
  16. 7 5
      sites/all/modules/contrib/admin/workflow/workflow_access/workflow_access.info
  17. 43 39
      sites/all/modules/contrib/admin/workflow/workflow_access/workflow_access.module
  18. 15 13
      sites/all/modules/contrib/admin/workflow/workflow_access/workflow_access.pages.inc
  19. 7 7
      sites/all/modules/contrib/admin/workflow/workflow_actions/workflow_actions.info
  20. 25 10
      sites/all/modules/contrib/admin/workflow/workflow_actions/workflow_actions.module
  21. 9 7
      sites/all/modules/contrib/admin/workflow/workflow_admin_ui/includes/Entity/EntityWorkflowUIController.php
  22. 5 3
      sites/all/modules/contrib/admin/workflow/workflow_admin_ui/workflow_admin_ui.api.php
  23. 7 7
      sites/all/modules/contrib/admin/workflow/workflow_admin_ui/workflow_admin_ui.info
  24. 10 9
      sites/all/modules/contrib/admin/workflow/workflow_admin_ui/workflow_admin_ui.module
  25. 2 2
      sites/all/modules/contrib/admin/workflow/workflow_admin_ui/workflow_admin_ui.page.labels.inc
  26. 3 2
      sites/all/modules/contrib/admin/workflow/workflow_admin_ui/workflow_admin_ui.page.permissions.inc
  27. 2 2
      sites/all/modules/contrib/admin/workflow/workflow_admin_ui/workflow_admin_ui.page.states.inc
  28. 2 2
      sites/all/modules/contrib/admin/workflow/workflow_admin_ui/workflow_admin_ui.page.transitions.inc
  29. 4 3
      sites/all/modules/contrib/admin/workflow/workflow_admin_ui/workflow_admin_ui.page.workflow.inc
  30. 8 7
      sites/all/modules/contrib/admin/workflow/workflow_cleanup/workflow_cleanup.info
  31. 5 2
      sites/all/modules/contrib/admin/workflow/workflow_cleanup/workflow_cleanup.module
  32. 2 2
      sites/all/modules/contrib/admin/workflow/workflow_cleanup/workflow_cleanup.pages.inc
  33. 29 0
      sites/all/modules/contrib/admin/workflow/workflow_field/workflowfield.field.inc
  34. 3 4
      sites/all/modules/contrib/admin/workflow/workflow_field/workflowfield.info
  35. 1 1
      sites/all/modules/contrib/admin/workflow/workflow_field/workflowfield.module
  36. 3 4
      sites/all/modules/contrib/admin/workflow/workflow_node/workflownode.info
  37. 1 1
      sites/all/modules/contrib/admin/workflow/workflow_node/workflownode.tokens.inc
  38. 0 236
      sites/all/modules/contrib/admin/workflow/workflow_notify/workflow_notify.admin.inc
  39. 7 7
      sites/all/modules/contrib/admin/workflow/workflow_notify/workflow_notify.info
  40. 118 67
      sites/all/modules/contrib/admin/workflow/workflow_notify/workflow_notify.module
  41. 230 0
      sites/all/modules/contrib/admin/workflow/workflow_notify/workflow_notify.pages.inc
  42. 8 6
      sites/all/modules/contrib/admin/workflow/workflow_notify/workflow_notify_og/workflow_notify_og.info
  43. 14 13
      sites/all/modules/contrib/admin/workflow/workflow_notify/workflow_notify_og/workflow_notify_og.module
  44. 7 7
      sites/all/modules/contrib/admin/workflow/workflow_revert/workflow_revert.info
  45. 2 2
      sites/all/modules/contrib/admin/workflow/workflow_revert/workflow_revert.pages.inc
  46. 5 6
      sites/all/modules/contrib/admin/workflow/workflow_rules/workflow_rules.info
  47. 8 8
      sites/all/modules/contrib/admin/workflow/workflow_search_api/workflow_search_api.info
  48. 5 7
      sites/all/modules/contrib/admin/workflow/workflow_vbo/workflow_vbo.info
  49. 1 1
      sites/all/modules/contrib/admin/workflow/workflow_views/handlers/workflow_views_handler_field_state.inc
  50. 3 4
      sites/all/modules/contrib/admin/workflow/workflow_views/workflow_views.info
  51. 39 0
      sites/all/modules/contrib/files/imagecache_actions/CHANGELOG.txt
  52. 3 4
      sites/all/modules/contrib/files/imagecache_actions/autorotate/imagecache_autorotate.info
  53. 33 3
      sites/all/modules/contrib/files/imagecache_actions/autorotate/imagecache_autorotate.module
  54. 468 24
      sites/all/modules/contrib/files/imagecache_actions/canvasactions/canvasactions.inc
  55. 3 4
      sites/all/modules/contrib/files/imagecache_actions/canvasactions/imagecache_canvasactions.info
  56. 16 0
      sites/all/modules/contrib/files/imagecache_actions/canvasactions/imagecache_canvasactions.module
  57. 2 2
      sites/all/modules/contrib/files/imagecache_actions/canvasactions/rounded_corners.inc
  58. 1 1
      sites/all/modules/contrib/files/imagecache_actions/canvasactions/tests/cheap_dropshadow.imagecache_preset.inc
  59. 3 4
      sites/all/modules/contrib/files/imagecache_actions/coloractions/imagecache_coloractions.info
  60. 238 8
      sites/all/modules/contrib/files/imagecache_actions/coloractions/imagecache_coloractions.module
  61. 53 2
      sites/all/modules/contrib/files/imagecache_actions/customactions/README.txt
  62. 3 4
      sites/all/modules/contrib/files/imagecache_actions/customactions/imagecache_customactions.info
  63. 7 1
      sites/all/modules/contrib/files/imagecache_actions/customactions/imagecache_customactions.module
  64. 15 2
      sites/all/modules/contrib/files/imagecache_actions/image_effects_text/README.txt
  65. 141 75
      sites/all/modules/contrib/files/imagecache_actions/image_effects_text/image_effects_text.inc
  66. 3 4
      sites/all/modules/contrib/files/imagecache_actions/image_effects_text/image_effects_text.info
  67. 3 4
      sites/all/modules/contrib/files/imagecache_actions/image_effects_text/image_effects_text_test/image_effects_text_test.info
  68. 5 12
      sites/all/modules/contrib/files/imagecache_actions/image_styles_admin/README.txt
  69. 35 38
      sites/all/modules/contrib/files/imagecache_actions/image_styles_admin/image_styles_admin.inc
  70. 3 4
      sites/all/modules/contrib/files/imagecache_actions/image_styles_admin/image_styles_admin.info
  71. 8 0
      sites/all/modules/contrib/files/imagecache_actions/image_styles_admin/image_styles_admin.install
  72. 27 2
      sites/all/modules/contrib/files/imagecache_actions/image_styles_admin/image_styles_admin.module
  73. 3 4
      sites/all/modules/contrib/files/imagecache_actions/imagecache_actions.info
  74. 3 4
      sites/all/modules/contrib/files/imagecache_actions/tests/imagecache_testsuite.info
  75. 2 2
      sites/all/modules/contrib/files/imagecache_actions/utility-form.inc
  76. 86 25
      sites/all/modules/contrib/files/imagecache_actions/utility.inc
  77. 1 1
      sites/all/modules/contrib/localisation/i18n/README.txt
  78. 3 4
      sites/all/modules/contrib/localisation/i18n/i18n.info
  79. 2 1
      sites/all/modules/contrib/localisation/i18n/i18n.module
  80. 33 15
      sites/all/modules/contrib/localisation/i18n/i18n_block/README.txt
  81. 3 4
      sites/all/modules/contrib/localisation/i18n/i18n_block/i18n_block.info
  82. 13 2
      sites/all/modules/contrib/localisation/i18n/i18n_block/i18n_block.module
  83. 3 2
      sites/all/modules/contrib/localisation/i18n/i18n_block/i18n_block.test
  84. 25 16
      sites/all/modules/contrib/localisation/i18n/i18n_contact/README.txt
  85. 3 4
      sites/all/modules/contrib/localisation/i18n/i18n_contact/i18n_contact.info
  86. 28 15
      sites/all/modules/contrib/localisation/i18n/i18n_field/README.txt
  87. 1 1
      sites/all/modules/contrib/localisation/i18n/i18n_field/i18n_field.i18n.inc
  88. 3 4
      sites/all/modules/contrib/localisation/i18n/i18n_field/i18n_field.info
  89. 62 4
      sites/all/modules/contrib/localisation/i18n/i18n_field/i18n_field.module
  90. 26 20
      sites/all/modules/contrib/localisation/i18n/i18n_forum/README.txt
  91. 3 4
      sites/all/modules/contrib/localisation/i18n/i18n_forum/i18n_forum.info
  92. 43 21
      sites/all/modules/contrib/localisation/i18n/i18n_menu/README.txt
  93. 3 4
      sites/all/modules/contrib/localisation/i18n/i18n_menu/i18n_menu.info
  94. 5 6
      sites/all/modules/contrib/localisation/i18n/i18n_menu/i18n_menu.module
  95. 45 20
      sites/all/modules/contrib/localisation/i18n/i18n_node/README.txt
  96. 3 4
      sites/all/modules/contrib/localisation/i18n/i18n_node/i18n_node.info
  97. 31 9
      sites/all/modules/contrib/localisation/i18n/i18n_node/i18n_node.module
  98. 18 1
      sites/all/modules/contrib/localisation/i18n/i18n_node/i18n_node.variable.inc
  99. 3 4
      sites/all/modules/contrib/localisation/i18n/i18n_path/i18n_path.info
  100. 0 0
      sites/all/modules/contrib/localisation/i18n/i18n_redirect/README.txt

+ 28 - 35
sites/all/modules/contrib/admin/workflow/includes/Entity/Workflow.php

@@ -89,7 +89,7 @@ class Workflow extends Entity implements WorkflowInterface {
   protected function preRebuild() {
     // Remap roles. They can come from another system with shifted role IDs.
     // See also https://drupal.org/node/1702626 .
-    $this->rebuildRoles($this->tab_roles);
+    $this->tab_roles = $this->rebuildRoles($this->tab_roles);
 
     // After update.php or import feature, label might be empty. @todo: remove in D8.
     if (empty($this->label)) {
@@ -160,30 +160,32 @@ class Workflow extends Entity implements WorkflowInterface {
       $data = (array)$data;
 
       if (is_numeric($name)) {
-        $start_state = $saved_states[$saved_state_names[$data['sid']]];
-        $end_state = $saved_states[$saved_state_names[$data['target_sid']]];
-        $name = WorkflowConfigTransition::machineName($start_state->getName(),
-          $end_state->getName());
+        if (isset($saved_states[$data['sid']]) && isset($saved_states[$data['target_sid']])) {
+          $start_state = $saved_states[$data['sid']];      // #2876303
+          $end_state = $saved_states[$data['target_sid']]; // #2876303
+        }
+        else {
+          $start_state = $this->getState($data['sid']);
+          $end_state = $this->getState($data['target_sid']);
+        }
       }
       else {
         $start_state = $saved_states[$data['start_state']];
         $end_state = $saved_states[$data['end_state']];
       }
-
+      $name = WorkflowConfigTransition::machineName($start_state->getName(), $end_state->getName());
       if (isset($db_transitions[$name])) {
         $transition = $db_transitions[$name];
       }
       else {
-        $transition = $this->createTransition($start_state->sid,
-          $end_state->sid);
+        $transition = $this->createTransition($start_state->sid, $end_state->sid);
       }
 
       $transition->wid = $this->wid;
       $transition->sid = $start_state->sid;
       $transition->target_sid = $end_state->sid;
       $transition->label = $data['label'];
-      $transition->roles = $data['roles'];
-      $this->rebuildRoles($transition->roles);
+      $transition->roles = $this->rebuildRoles($data['roles']);
       $transition->save();
 
       unset($db_transitions[$name]);
@@ -251,12 +253,14 @@ class Workflow extends Entity implements WorkflowInterface {
   public function isValid() {
     $is_valid = TRUE;
 
+    $workflow_name = $this->getName();
+    $wid = $this->getWorkflowId();
     // Don't allow workflows with no states. There should always be a creation state.
     $states = $this->getStates($all = FALSE);
     if (count($states) < 1) {
       // That's all, so let's remind them to create some states.
       $message = t('Workflow %workflow has no states defined, so it cannot be assigned to content yet.',
-        array('%workflow' => $this->getName()));
+        array('%workflow' => $workflow_name));
       drupal_set_message($message, 'warning');
 
       // Skip allowing this workflow.
@@ -268,7 +272,7 @@ class Workflow extends Entity implements WorkflowInterface {
     if (count($transitions) < 1) {
       // That's all, so let's remind them to create some transitions.
       $message = t('Workflow %workflow has no transitions defined, so it cannot be assigned to content yet.',
-        array('%workflow' => $this->getName()));
+        array('%workflow' => $workflow_name));
       drupal_set_message($message, 'warning');
 
       // Skip allowing this workflow.
@@ -281,7 +285,7 @@ class Workflow extends Entity implements WorkflowInterface {
       $message = t('Please maintain Workflow %workflow on its <a href="@url">settings</a> page.',
         array(
           '%workflow' => $this->getName(),
-          '@url' => url('admin/config/workflow/workflow/manage/' . $this->wid),
+          '@url' => url(WORKFLOW_ADMIN_UI_PATH . "/manage/$wid"),
         )
       );
       drupal_set_message($message, 'warning');
@@ -539,19 +543,7 @@ class Workflow extends Entity implements WorkflowInterface {
   }
 
   /**
-   * Loads all allowed ConfigTransitions for this workflow.
-   *
-   * @param mixed $tids
-   *   Array of Transitions IDs. If FALSE, show all transitions.
-   * @param array $conditions
-   *   $conditions['sid'] : if provided, a 'from' State ID.
-   *   $conditions['target_sid'] : if provided, a 'to' state ID.
-   *   $conditions['roles'] : if provided, an array of roles, or 'ALL'.
-   * @param bool $reset
-   *   Indicator to reset the cache.
-   *
-   * @return array
-   *   An array of keyed transitions.
+   * @inheritdoc
    */
   public function getTransitions($tids = FALSE, array $conditions = array(), $reset = FALSE) {
     $config_transitions = array();
@@ -690,21 +682,22 @@ class Workflow extends Entity implements WorkflowInterface {
   }
 
   protected function defaultLabel() {
-    return isset($this->label) ? $this->label : '';
+    return isset($this->label) ? t('@label', array('@label' => $this->label)) : '';
   }
 
   protected function defaultUri() {
-    return array('path' => 'admin/config/workflow/workflow/manage/' . $this->wid);
+    $wid = $this->wid;
+    return array('path' => WORKFLOW_ADMIN_UI_PATH . "/manage/$wid");
   }
 
-  protected function rebuildRoles(array &$roles) {
-    $role_map = isset($this->system_roles) ? $this->system_roles : array();
-    if (!$role_map) {
-      return;
-    }
+  protected function rebuildRoles(array $roles) {
+    $new_roles = array();
+
+    // @todo: importing Roles is incomplete when user language is not English.
+    // function user_roles() translates DRUPAL_ANONYMOUS_RID, DRUPAL_AUTHENTICATED_RID
+    $role_map = workflow_get_roles(NULL);
 
     // See also https://drupal.org/node/1702626 .
-    $new_roles = array();
     foreach ($roles as $key => $rid) {
       if ($rid == WORKFLOW_ROLE_AUTHOR_RID) {
         $new_roles[$rid] = $rid;
@@ -715,7 +708,7 @@ class Workflow extends Entity implements WorkflowInterface {
         }
       }
     }
-    $roles = $new_roles;
+    return $new_roles;
   }
 
 }

+ 29 - 4
sites/all/modules/contrib/admin/workflow/includes/Entity/WorkflowConfigTransition.php

@@ -51,11 +51,12 @@ class WorkflowConfigTransition extends Entity {
   }
 
   protected function defaultLabel() {
-    return $this->label;
+    return isset($this->label) ? t('@label', array('@label' => $this->label)) : '';
   }
 
   protected function defaultUri() {
-    return array('path' => 'admin/config/workflow/workflow/manage/' . $this->wid . '/transitions/');
+    $wid = $this->wid;
+    return array('path' => WORKFLOW_ADMIN_UI_PATH . "/manage/$wid/transitions/");
   }
 
   /**
@@ -96,11 +97,16 @@ class WorkflowConfigTransition extends Entity {
    * - In permissions;
    * - By permission hooks, implemented by other modules.
    *
+   * @param string|array $user_roles
+   *   The string 'ALL' to force allowing the transition, or an array of role
+   *   IDs to compare against the roles allowed for the transition.
+   *
    * @return bool
-   *   TRUE if OK, else FALSE.
+   *   If the transition is allowed, this function returns TRUE. Otherwise, it
+   *   returns FALSE.
    */
   public function isAllowed($user_roles) {
-    if ($user_roles == 'ALL') {
+    if ($user_roles === 'ALL') {
       // Superuser.
       return TRUE;
     }
@@ -132,6 +138,25 @@ class WorkflowConfigTransition extends Entity {
       $workflow->save();
     }
   }
+
+  /**
+   * Helper debugging function to easily show the contents of a transition.
+   */
+  public function dpm($function = 'not_specified') {
+    $transition = $this;
+    $time = NULL;
+
+    // Do this extensive $user_name lines, for some troubles with Action.
+    $t_string = get_class($this) . ' ' . $this->identifier() . " in function '$function'";
+    //$output[] = 'Entity  = ' . ((!$entity) ? 'NULL' : ($entity_type . '/' . $entity_bundle . '/' . $entity_id));
+    //$output[] = 'Field   = ' . $transition->getFieldName();
+    $output[] = 'From/To = ' . $transition->sid . ' > ' . $transition->target_sid . ' @ ' . $time;
+    //$output[] = 'Comment = ' . $user_name . ' says: ' . $transition->getComment();
+    //$output[] = 'Forced  = ' . ($transition->isForced() ? 'yes' : 'no');
+    if (function_exists('dpm')) { dpm($output, $t_string); }
+  }
+
+
 }
 
 /**

+ 7 - 4
sites/all/modules/contrib/admin/workflow/includes/Entity/WorkflowInterface.php

@@ -154,11 +154,14 @@ interface WorkflowInterface {
   /**
    * Loads all allowed ConfigTransitions for this workflow.
    *
-   * @param array|NULL $ids
-   *   Array of Transitions IDs. If NULL, show all transitions.
+   * @param array|bool $tids
+   *   Array of Transitions IDs. If FALSE, show all transitions.
    * @param array $conditions
-   *   $conditions['from_sid'] : if provided, a 'from' State ID.
-   *   $conditions['to_sid'] : if provided, a 'to' state ID.
+   *   $conditions['sid'] : if provided, a 'from' State ID.
+   *   $conditions['target_sid'] : if provided, a 'to' state ID.
+   *   $conditions['roles'] : if provided, an array of roles, or 'ALL'.
+   * @param bool $reset
+   *   Indicator to reset the cache.
    *
    * @return \Drupal\workflow\Entity\WorkflowConfigTransition[]
    */

+ 5 - 11
sites/all/modules/contrib/admin/workflow/includes/Entity/WorkflowState.php

@@ -153,7 +153,7 @@ class WorkflowState extends Entity {
   public static function loadByName($name, $wid = 0) {
     /* @var $state WorkflowState */
     foreach ($states = self::getStates($wid) as $state) {
-      if ($name == $state->getName()) {
+      if ($name == $state->name) {
         return $state;
       }
     }
@@ -458,7 +458,7 @@ class WorkflowState extends Entity {
       // We cannot use getTransitions, since there are no ConfigTransitions
       // from State with ID 0, and we do not want to repeat States.
       foreach ($workflow->getStates() as $state) {
-        $options[$state->value()] = $state->label(); // Translation is done later.
+        $options[$state->value()] = $state->label(); // Translation is done as part of defaultLabel().
       }
     }
     else {
@@ -473,7 +473,7 @@ class WorkflowState extends Entity {
           $label = $target_state ? $target_state->label() : '';
         }
         $new_sid = $transition->target_sid;
-        $options[$new_sid] = $label; // Translation is done later.
+        $options[$new_sid] = $label; // Translation is done as part of defaultLabel().
       }
 
       // Include current state for same-state transitions, except when $sid = 0.
@@ -481,16 +481,10 @@ class WorkflowState extends Entity {
       // but only if the transitions have been saved at least one time.
       if ($current_sid && ($current_sid != $workflow->getCreationSid())) {
         if (!isset($options[$current_sid])) {
-          $options[$current_sid] = $this->label(); // Translation is done later.
+          $options[$current_sid] = $this->label(); // Translation is done as part of defaultLabel().
         }
       }
 
-      // Properly fix the labels.
-      // Translate, convert '&', make secure.
-      foreach($options as $key => $label) {
-        $options[$key] = html_entity_decode(check_plain(t($label)));
-      }
-
       // Save to entity-specific cache.
       $cache[$entity_type][$entity_index][$force][$current_sid] = $options;
     }
@@ -538,7 +532,7 @@ class WorkflowState extends Entity {
    * Mimics Entity API functions.
    */
   protected function defaultLabel() {
-    return $this->state;
+    return isset($this->state) ? t('@state', array('@state' => $this->state)) : '';
   }
 
   public function getName() {

+ 1 - 1
sites/all/modules/contrib/admin/workflow/includes/Entity/WorkflowTransition.php

@@ -446,7 +446,7 @@ class WorkflowTransition extends Entity {
           $args = array(
             '@type' => $entity_type_info['label'],
             '%label' => entity_label($entity_type, $entity),
-            '%state_name' => check_plain(t($new_state->label())),
+            '%state_name' => $new_state->label(),
           );
           $uri = entity_uri($entity_type, $entity);
           watchdog('workflow', $message, $args, WATCHDOG_NOTICE, l('view', $uri['path']));

+ 6 - 5
sites/all/modules/contrib/admin/workflow/includes/Field/WorkflowItem.php

@@ -111,7 +111,7 @@ class WorkflowItem extends WorkflowD7Base {// D8: extends ConfigFieldItemBase im
       '#default_value' => $wid,
       '#required' => TRUE,
       '#disabled' => $has_data,
-      '#description' => t('Choose the Workflow type. Maintain workflows !url.', array('!url' => l(t('here'), 'admin/config/workflow/workflow'))),
+      '#description' => t('Choose the Workflow type. Maintain workflows !url.', array('!url' => l(t('here'), WORKFLOW_ADMIN_UI_PATH))),
     );
 
     // Inform the user of possible states.
@@ -297,7 +297,7 @@ class WorkflowItem extends WorkflowD7Base {// D8: extends ConfigFieldItemBase im
           $previous_wid = $state->wid;
           $lines[] = $state->name . "'s states: ";
         }
-        $label = check_plain(t($state->label()));
+        $label = $state->label();
         $states[$state->sid] = $label;
         $lines[] = $state->sid . ' | ' . $label;
       }
@@ -317,12 +317,13 @@ class WorkflowItem extends WorkflowD7Base {// D8: extends ConfigFieldItemBase im
    * @return array
    *   The array of allowed values. Keys of the array are the raw stored values
    *   (number or text), values of the array are the display labels.
-   *   It contains all possible values, beause the result is cached,
-   *   and used for all nodes on a page.
+   *   It contains all possible values for the field, because the result is
+   *   cached on a field basis, and used for all nodes on a page.
    */
   public function getAllowedValues() {
     // Get all state names, including inactive states.
-    $options = workflow_get_workflow_state_names(0, $grouped = FALSE, $all = TRUE);
+    $wid = isset($this->field['settings']['wid']) ? $this->field['settings']['wid'] : 0;
+    $options = workflow_get_workflow_state_names($wid, $grouped = FALSE, $all = TRUE);
     return $options;
   }
 

+ 7 - 6
sites/all/modules/contrib/admin/workflow/includes/Form/WorkflowTransitionForm.php

@@ -190,7 +190,7 @@ class WorkflowTransitionForm { // extends FormBase {
       }
     }
 
-    $workflow_label = $workflow ? check_plain(t($workflow->label())) : '';
+    $workflow_label = $workflow ? $workflow->label() : '';
 
     // Change settings locally.
     if (!$field_name) {
@@ -300,7 +300,7 @@ class WorkflowTransitionForm { // extends FormBase {
       else {
         $element['workflow'] += array(
           '#type' => 'fieldset',
-          '#title' => t($workflow_label),
+          '#title' => $workflow_label,
           '#collapsible' => TRUE,
           '#collapsed' => ($settings_fieldset == 1) ? FALSE : TRUE,
         );
@@ -312,13 +312,13 @@ class WorkflowTransitionForm { // extends FormBase {
       $help_text = isset($instance['description']) ? $instance['description'] : '';
       $element['workflow']['workflow_sid'] = array(
         '#type' => $settings_options_type,
-        '#title' => $settings_title_as_name ? t('Change !name state', array('!name' => $workflow_label)) : t('Target state'),
+        '#title' => $settings_title_as_name ? t('Change @name state', array('@name' => $workflow_label)) : t('Target state'),
         '#access' => TRUE,
         '#options' => $options,
         // '#name' => $workflow_label,
         // '#parents' => array('workflow'),
         '#default_value' => $default_value,
-        '#description' => $help_text,
+        '#description' => t('@help', array('@help' => $help_text)),
       );
     }
 
@@ -605,7 +605,7 @@ class WorkflowTransitionForm { // extends FormBase {
       // content is not associated to a workflow, old_sid is now 0. This may
       // happen in workflow_vbo, if you assign a state to non-relevant nodes.
       $entity_id = entity_id($entity_type, $entity);
-      drupal_set_message(t('Error: content !id has no workflow attached. The data is not saved.', array('!id' => $entity_id)), 'error');
+      drupal_set_message(t('Error: content @id has no workflow attached. The data is not saved.', array('@id' => $entity_id)), 'error');
       // The new state is still the previous state.
       $new_sid = $old_sid;
       return $new_sid;
@@ -617,7 +617,8 @@ class WorkflowTransitionForm { // extends FormBase {
     // Try to execute the transition. Return $old_sid when error.
     if (!$transition) {
       // This should only happen when testing/developing.
-      drupal_set_message(t('Error: the transition from %old_sid to %new_sid could not be generated.'), 'error');
+      drupal_set_message(t('Error: the transition from @old_sid to @new_sid could not be generated.',
+        array('@old_sid' => $old_sid, '@new_sid' => $new_sid)), 'error');
       // The current value is still the previous state.
       $new_sid = $old_sid;
     }

+ 4 - 6
sites/all/modules/contrib/admin/workflow/workflow.deprecated.inc

@@ -46,16 +46,14 @@ function workflow_get_workflows_by_name($name) {
  * @deprecated: workflow_get_wid_label --> workflow_label
  */
 function workflow_get_wid_label($wid) {
+  $label = t('Unknown workflow');
   if (empty($wid)) {
-    $output = t('No workflow');
+    $label = t('No workflow');
   }
   elseif ($workflow = workflow_load_single($wid)) {
-    $output = $workflow->label();
+    $label = $workflow->label();
   }
-  else {
-    $output = t('Unknown workflow');
-  }
-  return $output;
+  return $label;
 }
 
 /**

+ 7 - 7
sites/all/modules/contrib/admin/workflow/workflow.entity.inc

@@ -36,7 +36,7 @@ function workflow_entity_info() {
     /*
     // 'access callback' => 'workflow_access',
     // 'admin ui' => array(
-    //   'path' => 'admin/config/workflow/workflow',
+    //   'path' => WORKFLOW_ADMIN_UI_PATH,
     //   'file' => 'workflow_admin_ui/workflow_admin_ui.pages.inc',
     //   'controller class' => 'EntityWorkflowUIController',
     //   'menu wildcard' => '%workflow',
@@ -110,7 +110,7 @@ function workflow_entity_info() {
     ),
 
 //    'admin ui' => array(
-//      'path' => 'admin/config/workflow/workflow/manage/%workflow_transition/fields2',
+//      'path' => WORKFLOW_ADMIN_UI_PATH . '/manage/%workflow_transition/fields2',
 //      'menu wildcard' => '%workflow_transition',
 //      'controller class' => 'EntityDefaultUIController',
 //    ),
@@ -147,12 +147,12 @@ function workflow_entity_info() {
   }
 
   // Build an array of bundles.
-  foreach ($types as $type => $info) {
-    $entities['WorkflowTransition']['bundles'][$type] = array(
+  foreach ($types as $wid => $info) {
+    $entities['WorkflowTransition']['bundles'][$wid] = array(
       'label' => $info->label,
       'admin' => array(
-        'path' => 'admin/config/workflow/workflow/manage/%workflow',
-        'real path' => 'admin/config/workflow/workflow/manage/' . $type,
+        'path' => WORKFLOW_ADMIN_UI_PATH . '/manage/%workflow',
+        'real path' => WORKFLOW_ADMIN_UI_PATH . "/manage/$wid",
         'bundle argument' => 5,
 //        'access callback' => 'workflow_access',
       ),
@@ -510,7 +510,7 @@ function workflow_label($workflow) {
     $output = t('No workflow');
   }
   elseif ($workflow) {
-    $output = check_plain(t($workflow->label()));
+    $output = $workflow->label();
   }
   else {
     // E.g., NULL.

+ 18 - 4
sites/all/modules/contrib/admin/workflow/workflow.features.inc

@@ -31,8 +31,6 @@ class WorkflowFeaturesController extends EntityDefaultFeaturesController {
         if (count($workflow->getTypeMap())) {
           $export['dependencies']['workflownode'] = 'workflownode';
         }
-        // Add dependency on workflow_field.
-        $export['features']['Workflow'][$workflow_name] = $workflow_name;
       }
     }
 
@@ -109,7 +107,21 @@ class WorkflowFeaturesController extends EntityDefaultFeaturesController {
     // Add roles to translate role IDs on target system.
     $permission = NULL;
 
+    // Get system roles.
     $workflow->system_roles = workflow_get_roles($permission);
+    // Only export system roles for roles used by this workflow.
+    $roles = array();
+    foreach ($workflow->transitions as $id => $transition) {
+      foreach ($transition->roles as $rid) {
+        $roles[] = $rid;
+      }
+    }
+    $roles = array_unique($roles);
+    foreach ($workflow->system_roles as $id => $system_role) {
+      if (!in_array($id, $roles)) {
+        unset($workflow->system_roles[$id]);
+      }
+    }
 
     $sid_to_name_map = $this->pack_states($workflow);
     $this->pack_transitions($workflow, $sid_to_name_map);
@@ -198,8 +210,10 @@ class WorkflowFeaturesController extends EntityDefaultFeaturesController {
     // Loads defaults from feature code.
     $defaults = workflow_get_defaults($module);
 
-    foreach ($defaults as $machine_name => $entity) {
-      workflow_revert($defaults, $machine_name);
+    if (!empty($defaults)) {
+      foreach ($defaults as $machine_name => $entity) {
+        workflow_revert($defaults, $machine_name);
+      }
     }
   }
 }

+ 4 - 5
sites/all/modules/contrib/admin/workflow/workflow.info

@@ -3,7 +3,7 @@ description = Workflow API. (Enable Workflow Node or Workflow Field to add arbit
 package = Workflow
 core = 7.x
 
-dependencies[] = entity (>7.x-1.5)
+dependencies[] = entity (>7.x-1.6)
 dependencies[] = list
 
 files[] = includes/Entity/Workflow.php
@@ -18,9 +18,8 @@ files[] = includes/Field/WorkflowDefaultWidget.php
 files[] = includes/Form/WorkflowTransitionForm.php
 files[] = workflow.features.inc
 
-; Information added by Drupal.org packaging script on 2017-01-15
-version = "7.x-2.9+10-dev"
+; Information added by Drupal.org packaging script on 2019-05-23
+version = "7.x-2.13"
 core = "7.x"
 project = "workflow"
-datestamp = "1484510888"
-
+datestamp = "1558597389"

+ 9 - 2
sites/all/modules/contrib/admin/workflow/workflow.install

@@ -790,7 +790,7 @@ function workflow_update_7016() {
 }
 
 /**
- * Add a primary key to {workflow_scheduled_transition}.
+ * Add/correct a primary key to {workflow_scheduled_transition}.
  */
 function workflow_update_7017() {
   // Drop existing primary key.
@@ -799,11 +799,18 @@ function workflow_update_7017() {
   // Add new primary key.
   $spec = array(
     'type' => 'serial',
+    'not null' => TRUE,
   );
   $keys_new =  array(
     'primary key' => array('tid'),
   );
-  db_add_field('workflow_scheduled_transition', 'tid', $spec, $keys_new);
+
+  if (!db_field_exists('workflow_scheduled_transition', 'tid') ) {
+    db_add_field('workflow_scheduled_transition', 'tid', $spec, $keys_new);
+  }
+  else {
+    db_change_field('workflow_scheduled_transition', 'tid', 'tid', $spec, $keys_new);
+  }
 
   return t('Added tid primary key to {workflow_scheduled_transition}');
 }

+ 12 - 5
sites/all/modules/contrib/admin/workflow/workflow.module

@@ -13,6 +13,8 @@ define('WORKFLOW_CREATION_STATE_NAME', '(' . t('creation') . ')');
 // #2657072 brackets are added later to indicate a special role, and distinguish from frequently used 'author' role.
 define('WORKFLOW_ROLE_AUTHOR_NAME', 'author');
 define('WORKFLOW_ROLE_AUTHOR_RID', '-1');
+// The definition of the Admin UI pages.
+define('WORKFLOW_ADMIN_UI_PATH', 'admin/config/workflow/workflow');
 
 // The definition of the Field_info property type. Shared between 'workflow_field' and 'workflow_rules'.
 define('WORKFLOWFIELD_PROPERTY_TYPE', 'text'); // @todo: 'list', 'text' or 'workflow'?
@@ -133,9 +135,10 @@ function workflow_menu_alter(&$items) {
 
         // Add the workflow tab in the Entity Admin UI.
         if (!empty($entity_info['admin ui']['path'])) {
-          $entity_position = substr_count($entity_info['admin ui']['path'], '/') + 2;
+          $admin_path = $entity_info['admin ui']['path'];
+          $entity_position = substr_count($admin_path, '/') + 2;
           $wildcard = (isset($entity_info['admin ui']['menu wildcard']) ? $entity_info['admin ui']['menu wildcard'] : '%entity_object');
-          $items[$entity_info['admin ui']['path'] . '/manage/' . $wildcard . '/workflow'] = $menu_item + array(
+          $items["$admin_path/manage/$wildcard/workflow"] = $menu_item + array(
               'page arguments' => array($type, $entity_position),
               'access arguments' => array($type, $entity_position),
               'load arguments' => array($type),
@@ -609,7 +612,11 @@ function workflow_get_workflow_state_names($wid = 0, $grouped = FALSE, $all = FA
   // Since this function is only used in UI, it is save to use the global $user.
   global $user;
 
-  foreach (workflow_load_multiple($wid ? array($wid) : FALSE) as $workflow) {
+  /* @var $workflows Workflow[] */
+  $workflows = workflow_load_multiple($wid ? array($wid) : FALSE);
+  // Do not group if only 1 Workflow is configured or selected.
+  $grouped = count($workflows) == 1 ? FALSE : $grouped;
+  foreach ($workflows as $workflow) {
     $state = new WorkflowState(array('wid' => $workflow->wid));
     $workflow_options = $state->getOptions('', NULL, '', $user, FALSE);
 
@@ -636,7 +643,7 @@ function workflow_get_workflow_state_names($wid = 0, $grouped = FALSE, $all = FA
 function workflow_get_workflow_names() {
   $options = array();
   foreach (workflow_load_multiple() as $workflow) {
-    $options[$workflow->wid] = html_entity_decode(t($workflow->label()));
+    $options[$workflow->wid] = $workflow->label();
   }
 
   return $options;
@@ -655,7 +662,7 @@ function workflow_get_sid_label($sid) {
   else {
     $label = 'Unknown state';
   }
-  return html_entity_decode(t($label));
+  return $label;
 }
 
 /**

+ 2 - 2
sites/all/modules/contrib/admin/workflow/workflow.pages.inc

@@ -61,7 +61,7 @@ function workflow_tab_page($entity_type, $entity = NULL) {
     $new_state = $history->getNewState();
     if ($new_state) {
       $name = $new_state->getName();
-      $label = check_plain(t($new_state->label()));
+      $label = $new_state->label();
     }
 
     if (!$new_state) {
@@ -98,7 +98,7 @@ function workflow_tab_page($entity_type, $entity = NULL) {
     $old_state = $history->getOldState();
     if ($old_state) {
       $name = $old_state->getName();
-      $label = check_plain(t($old_state->label()));
+      $label = $old_state->label();
     }
 
     if (!$old_state) {

+ 2 - 2
sites/all/modules/contrib/admin/workflow/workflow.tokens.inc

@@ -184,7 +184,7 @@ function workflow_tokens($type, $tokens, array $data = array(), array $options =
         switch (end($name_parts)) {
           case 'comment':
             if (isset($entity->workflow_transitions) && isset($entity->workflow_transitions[$name_parts[0]])) {
-              $replacements[$original] = $entity->workflow_transitions[$name_parts[0]]->$name_parts[1];
+              $replacements[$original] = $entity->workflow_transitions[$name_parts[0]]->{$name_parts[1]};
             }
             break;
         }
@@ -317,7 +317,7 @@ function _workflow_token_get_token($wrapper, $options) {
   // If there is a label for a property, e.g., defined by an options list or an
   // entity label, make use of it.
   if ($label = $wrapper->label()) {
-    return empty($options['sanitize']) ? $label : check_plain(t($label, array(), array('langcode' => $langcode)));
+    return $label;
   }
 
   switch ($wrapper->type()) {

+ 7 - 5
sites/all/modules/contrib/admin/workflow/workflow_access/workflow_access.info

@@ -1,12 +1,14 @@
 name = Workflow access
 description = Content access control based on workflows and roles. Depends on the node_access system, so only works for entities of type 'node'.
-dependencies[] = workflow
 package = Workflow
 core = 7.x
 
-; Information added by Drupal.org packaging script on 2017-01-15
-version = "7.x-2.9+10-dev"
+dependencies[] = workflow
+
+configure = admin/config/workflow/workflow
+
+; Information added by Drupal.org packaging script on 2019-05-23
+version = "7.x-2.13"
 core = "7.x"
 project = "workflow"
-datestamp = "1484510888"
-
+datestamp = "1558597389"

+ 43 - 39
sites/all/modules/contrib/admin/workflow/workflow_access/workflow_access.module

@@ -7,16 +7,14 @@
 
 /**
  * Implements hook_menu().
- *
- * Uses pattern of EntityWorkflowUIController::hook_menu().
  */
 function workflow_access_menu() {
   $items = array();
 
-  $path = 'admin/config/workflow/workflow';
-  $id_count = count(explode('/', $path));
+  $admin_path = WORKFLOW_ADMIN_UI_PATH;
+  $id_count = count(explode('/', $admin_path));
 
-  $items[$path . '/access'] = array(
+  $items["$admin_path/access"] = array(
     'title' => 'Access settings',
     'file' => 'workflow_access.pages.inc',
     'access arguments' => array('administer workflow'),
@@ -24,34 +22,64 @@ function workflow_access_menu() {
     'page arguments' => array('workflow_access_priority_form'),
     'type' => MENU_LOCAL_ACTION,
   );
-  $items[$path . '/manage/%workflow/access'] = array(
+  $items["$admin_path/manage/%workflow/access"] = array(
     'title' => 'Access',
     'file' => 'workflow_access.pages.inc',
     'access arguments' => array('administer workflow'),
     'page callback' => 'drupal_get_form',
-    'page arguments' => array(
-      'workflow_access_form',
-      $id_count + 1,
-      $id_count + 2,
-    ),
-    // 'type' => MENU_CALLBACK,
-    // 'type' => MENU_LOCAL_TASK,
+    'page arguments' => array('workflow_access_form', $id_count + 1),
+    'type' => MENU_CALLBACK,
   );
 
   return $items;
 }
 
 /**
+ * Implements hook_workflow_operations().
+ */
+function workflow_access_workflow_operations($op, $workflow = NULL, $state = NULL) {
+  $admin_path = WORKFLOW_ADMIN_UI_PATH;
+
+  switch ($op) {
+    case 'workflow':
+      $actions = array();
+      if ($workflow && $workflow->getStates()) {
+        $wid = $workflow->getWorkflowId();
+        $alt = t('Control content access for @wf', array('@wf' => $workflow->getName()));
+        $actions += array(
+          'workflow_access_form' => array(
+            'title' => t('Access'),
+            'href' => "$admin_path/manage/$wid/access",
+            'attributes' => array('alt' => $alt, 'title' => $alt),
+          ),
+        );
+      }
+      else {
+        // Generate a dummy, if no states exist.
+        $actions = array(
+          'workflow_access_form' => array(
+            'title' => '',
+            'href' => '',
+          ),
+        );
+      }
+
+      return $actions;
+  }
+}
+
+/**
  * Implements hook_help().
  */
 function workflow_access_help($path, $arg) {
   $help = '';
+
   switch ($path) {
-    case 'admin/config/workflow/workflow/manage/%/access':
+    case WORKFLOW_ADMIN_UI_PATH . '/manage/%/access':
       $help = t("WARNING: Use of the 'Edit any', 'Edit own', and even 'View
         published content' permissions for the content type may override these
         access settings. You may need to <a href='!url'>alter the priority of
-        the Workflow access module</a>.", array('!url' => url('admin/config/workflow/workflow/access'))
+        the Workflow access module</a>.", array('!url' => url(WORKFLOW_ADMIN_UI_PATH . '/access'))
       );
 
       if (module_exists('og')) {
@@ -90,30 +118,6 @@ function workflow_access_features_api() {
 }
 
 /**
- * Implements hook_workflow_operations().
- *
- * Create action link for access form on EntityWorkflowUIController::overviewForm.
- */
-function workflow_access_workflow_operations($op, $workflow = NULL, $state = NULL) {
-  switch ($op) {
-    case 'workflow':
-      $actions = array();
-      $wid = $workflow->wid;
-
-      $alt = t('Control content access for @wf', array('@wf' => $workflow->getName()));
-      $actions += array(
-        'workflow_access_form' => array(
-          'title' => t('Access'),
-          'href' => "admin/config/workflow/workflow/manage/$wid/access",
-          'attributes' => array('alt' => $alt, 'title' => $alt),
-        ),
-      );
-
-      return $actions;
-  }
-}
-
-/**
  * Implements hook_node_grants().
  *
  * Supply the workflow access grants. We are simply using

+ 15 - 13
sites/all/modules/contrib/admin/workflow/workflow_access/workflow_access.pages.inc

@@ -36,7 +36,7 @@ function workflow_access_priority_form($form, $form_state) {
  */
 function workflow_access_priority_form_submit($form, &$form_state) {
   variable_set('workflow_access_priority', $form_state['values']['workflow_access']['workflow_access_priority']);
-  $form_state['redirect'] = 'admin/config/workflow/workflow';
+  $form_state['redirect'] = WORKFLOW_ADMIN_UI_PATH;
 }
 
 
@@ -46,18 +46,18 @@ function workflow_access_priority_form_submit($form, &$form_state) {
  * Add a "three dimensional" (state, role, permission type) configuration
  * interface to the workflow edit form.
  */
-function workflow_access_form($form, $form_state, $workflow, $op) {
-  if (!$workflow) {
-    // Leave this page immediately.
-    drupal_set_message(t('Unknown workflow'));
-    drupal_goto('admin/config/workflow/workflow');
+function workflow_access_form($form, $form_state, Workflow $workflow) {
+  // If we don't have a workflow that goes with this, return to the admin pg.
+  if (!is_object($workflow)) {
+    drupal_set_message(t('Improper worklow ID provided.'), 'error');
+    drupal_goto(WORKFLOW_ADMIN_UI_PATH);
   }
 
-  drupal_set_title(t('@name Access', array('@name' => $workflow->label()))); // No t() for Settings page.
+  // @todo: Let's get a better page title.
+  drupal_set_title(t('@name Access', array('@name' => $workflow->label())));
 
-  $form = array('#tree' => TRUE);
-
-  $form['#wid'] = $workflow->wid;
+  $form['#tree'] = TRUE;
+  $form['#wid'] = $wid = $workflow->getWorkflowId();
 
   // A list of role names keyed by role ID, including the 'author' role.
   $roles = workflow_get_roles('participate in workflow');
@@ -90,7 +90,7 @@ function workflow_access_form($form, $form_state, $workflow, $op) {
     // @todo: better tables using a #theme function instead of direct #prefixing.
     $form[$state->sid] = array(
       '#type' => 'fieldset',
-      '#title' => check_plain($state->label()),
+      '#title' => $state->label(),
       '#collapsible' => TRUE,
       '#collapsed' => FALSE,
       '#tree' => TRUE,
@@ -131,6 +131,8 @@ function workflow_access_form($form, $form_state, $workflow, $op) {
  * Stores permission settings for workflow states.
  */
 function workflow_access_form_submit($form, &$form_state) {
+  $wid = $form['#wid'];
+
   foreach ($form_state['values'] as $sid => $access) {
     // Ignore irrelevant keys.
     if (!is_numeric($sid)) {
@@ -148,10 +150,10 @@ function workflow_access_form_submit($form, &$form_state) {
     }
 
     // Update all nodes having same workflow state to reflect new settings.
-    // just set a flag, which is working for both Workflow Field ánd Workflow Node.
+    // just set a flag, which is working for both Workflow Field ánd Workflow Node.
     node_access_needs_rebuild(TRUE);
   }
 
   drupal_set_message(t('Workflow access permissions updated.'));
-  $form_state['redirect'] = 'admin/config/workflow/workflow/' . $form['#wid'];
+  $form_state['redirect'] = WORKFLOW_ADMIN_UI_PATH;
 }

+ 7 - 7
sites/all/modules/contrib/admin/workflow/workflow_actions/workflow_actions.info

@@ -1,15 +1,15 @@
 name = Workflow Trigger
 description = Enables actions to be fired upon a Workflow State change.
+package = Workflow
+core = 7.x
 
-dependencies[] = workflow
 dependencies[] = trigger
+dependencies[] = workflow
 
-package = Workflow
-core = 7.x
+configure = admin/structure/trigger/workflow
 
-; Information added by Drupal.org packaging script on 2017-01-15
-version = "7.x-2.9+10-dev"
+; Information added by Drupal.org packaging script on 2019-05-23
+version = "7.x-2.13"
 core = "7.x"
 project = "workflow"
-datestamp = "1484510888"
-
+datestamp = "1558597389"

+ 25 - 10
sites/all/modules/contrib/admin/workflow/workflow_actions/workflow_actions.module

@@ -1,4 +1,5 @@
 <?php
+
 /**
  * @file
  * Enables actions to be fired upon a Workflow State change.
@@ -13,17 +14,31 @@
 
 /**
  * Implements hook_workflow_operations().
- *
- * Menu callback, called in workflow.admin.inc to add actions for states.
  */
-function workflow_actions_workflow_operations($level, $workflow = NULL, $state = NULL) {
-  if ($workflow) {
-    return array(
-      'workflow_overview_actions' => array(
-        'title' => t('Actions'),
-        'href' => 'admin/structure/trigger/workflow/' . $workflow->wid,
-      ),
-    );
+function workflow_actions_workflow_operations($op, $workflow = NULL, $state = NULL) {
+  switch ($op) {
+    case 'workflow':
+      $actions = array();
+      if ($workflow && $workflow->getStates()) {
+        $wid = $workflow->getWorkflowId();
+        $actions = array(
+          'workflow_overview_actions' => array(
+            'title' => t('Actions'),
+            'href' => "admin/structure/trigger/workflow/$wid",
+          ),
+        );
+      }
+      else {
+        // Generate a dummy, if no states exist.
+        $actions = array(
+          'workflow_overview_actions' => array(
+            'title' => '',
+            'href' => '',
+          ),
+        );
+      }
+
+      return $actions;
   }
 }
 

+ 9 - 7
sites/all/modules/contrib/admin/workflow/workflow_admin_ui/includes/Entity/EntityWorkflowUIController.php

@@ -13,7 +13,8 @@ class EntityWorkflowUIController extends EntityDefaultUIController {
     $items = parent::hook_menu();
 
     // Set this on the object so classes that extend hook_menu() can use it.
-    $id_count = count(explode('/', $this->path));
+    $admin_path = $this->path;
+    $id_count = count(explode('/', $admin_path));
     $wildcard = isset($this->entityInfo['admin ui']['menu wildcard']) ? $this->entityInfo['admin ui']['menu wildcard'] : '%entity_object';
     $plural_label = isset($this->entityInfo['plural label']) ? $this->entityInfo['plural label'] : $this->entityInfo['label'] . 's';
     $entityType = $this->entityInfo['entity class'];
@@ -27,7 +28,7 @@ class EntityWorkflowUIController extends EntityDefaultUIController {
       'type' => MENU_LOCAL_TASK,
     );
 
-    $items[$this->path . '/manage/' . $wildcard . '/states'] = $item + array(
+    $items["$admin_path/manage/$wildcard/states"] = $item + array(
       'file' => 'workflow_admin_ui/workflow_admin_ui.page.states.inc',
       'title' => 'States',
       'weight' => '11',
@@ -35,7 +36,7 @@ class EntityWorkflowUIController extends EntityDefaultUIController {
       'page arguments' => array('workflow_admin_ui_states_form', $id_count + 1, $id_count + 2),
     );
 
-    $items[$this->path . '/manage/' . $wildcard . '/transitions'] = $item + array(
+    $items["$admin_path/manage/$wildcard/transitions"] = $item + array(
       'file' => 'workflow_admin_ui/workflow_admin_ui.page.transitions.inc',
       'title' => 'Transitions',
       'weight' => '12',
@@ -43,7 +44,7 @@ class EntityWorkflowUIController extends EntityDefaultUIController {
       'page arguments' => array('workflow_admin_ui_transitions_form', $id_count + 1, $id_count + 2),
     );
 
-    $items[$this->path . '/manage/' . $wildcard . '/labels'] = $item + array(
+    $items["$admin_path/manage/$wildcard/labels"] = $item + array(
       'file' => 'workflow_admin_ui/workflow_admin_ui.page.labels.inc',
       'title' => 'Labels',
       'weight' => '13',
@@ -51,7 +52,7 @@ class EntityWorkflowUIController extends EntityDefaultUIController {
       'page arguments' => array('workflow_admin_ui_labels_form', $id_count + 1, $id_count + 2),
     );
 
-    $items[$this->path . '/manage/' . $wildcard . '/permissions'] = $item + array(
+    $items["$admin_path/manage/$wildcard/permissions"] = $item + array(
       'file' => 'workflow_admin_ui/workflow_admin_ui.page.permissions.inc',
       'title' => 'Permission summary',
       'weight' => '14',
@@ -146,10 +147,11 @@ class EntityWorkflowUIController extends EntityDefaultUIController {
    * @see https://www.drupal.org/node/1043634
    */
   public function applyOperation($op, $entity) {
+    $admin_path = $this->path;
     $label = entity_label($this->entityType, $entity);
     $vars = array('%entity' => $this->entityInfo['label'], '%label' => $label);
-    $id = entity_id($this->entityType, $entity);
-    $edit_link = l(t('edit'), $this->path . '/manage/' . $id . '/edit');
+    $wid = entity_id($this->entityType, $entity);
+    $edit_link = l(t('edit'), "$admin_path/manage/$wid/edit");
 
     switch ($op) {
       case 'revert':

+ 5 - 3
sites/all/modules/contrib/admin/workflow/workflow_admin_ui/workflow_admin_ui.api.php

@@ -7,18 +7,20 @@
 /**
  * Implements hook_workflow_operations().
  *
+ * Menu callback; adds links on EntityWorkflowUIController::overviewForm.
+ *
  * @param string $op
  *   'top_actions': Allow modules to insert their own front page action links.
  *   'operations': Allow modules to insert their own workflow operations.
  *   'state':  Allow modules to insert state operations.
- * @param object $workflow
+ * @param Workflow $workflow
  *   The current workflow object.
- * @param object $state
+ * @param WorkflowState $state
  *   The current state object.
  *
  * @return array
  */
-function hook_workflow_operations($op, object $workflow, object $state) {
+function hook_workflow_operations($op, Workflow $workflow, WorkflowState $state) {
   switch ($op) {
     case 'top_actions':
       $actions = array();

+ 7 - 7
sites/all/modules/contrib/admin/workflow/workflow_admin_ui/workflow_admin_ui.info

@@ -1,17 +1,17 @@
 name = Workflow UI
-description = "Provides administrative UI for workflow."
+description = Provides an administrative UI for workflows.
 package = Workflow
 core = 7.x
 
-configure = admin/config/workflow/workflow
-
 dependencies[] = workflow
+
 files[] = includes/Entity/EntityWorkflowUIController.php
 stylesheets[all][] = workflow_admin_ui.css
 
-; Information added by Drupal.org packaging script on 2017-01-15
-version = "7.x-2.9+10-dev"
+configure = admin/config/workflow/workflow
+
+; Information added by Drupal.org packaging script on 2019-05-23
+version = "7.x-2.13"
 core = "7.x"
 project = "workflow"
-datestamp = "1484510888"
-
+datestamp = "1558597389"

+ 10 - 9
sites/all/modules/contrib/admin/workflow/workflow_admin_ui/workflow_admin_ui.module

@@ -19,10 +19,12 @@ define('WORKFLOW_ADMIN_UI_ARROW', '&#8594;');
  * Adds Admin UI to entities, using EntityWorkflowUIController.
  */
 function workflow_admin_ui_entity_info_alter(&$entity_info) {
+  $admin_path = WORKFLOW_ADMIN_UI_PATH;
+
   $entity_info['Workflow'] += array(
     'access callback' => 'workflow_access',
     'admin ui' => array(
-      'path' => 'admin/config/workflow/workflow',
+      'path' => $admin_path,
       // Do not add 'file', since each page has its own file.
       // 'file' => 'workflow_admin_ui/workflow_admin_ui.pages.inc',
       'controller class' => 'EntityWorkflowUIController',
@@ -38,8 +40,7 @@ function workflow_admin_ui_help($path, $arg) {
   switch ($path) {
 
     case 'admin/modules':
-    case 'admin/config/workflow/workflow':
-    // case 'admin/config/workflow/workflow/manage/%/states': // Already has its own text.
+    case WORKFLOW_ADMIN_UI_PATH:
       if (module_exists('workflownode') && module_exists('workflowfield')) {
         $m = t('Do not enable Workfow Node and Workflow Field submodules at the
           same time (unless you are in a migration phase). Visit the <a href=
@@ -49,12 +50,12 @@ function workflow_admin_ui_help($path, $arg) {
       }
       return;
 
-    case 'admin/config/workflow/workflow/add':
+    case WORKFLOW_ADMIN_UI_PATH . '/add':
       return t('To get started, provide a name for your workflow. This name
         will be used as a label when the workflow status is shown during node
         editing.');
 
-    case 'admin/config/workflow/workflow/manage/%/states':
+    case WORKFLOW_ADMIN_UI_PATH . '/manage/%/states':
       return t("To create a new state, enter its name in the last row of the
         'State' column. Check the 'Active' box to make it effective. You may
         also drag it to the appropriate position.") . '<br />'
@@ -64,7 +65,7 @@ function workflow_admin_ui_help($path, $arg) {
         not zero), then you need to select a state to which to reassign that
         content.");
 
-    case 'admin/config/workflow/workflow/manage/%/transitions':
+    case WORKFLOW_ADMIN_UI_PATH . '/manage/%/transitions':
       return t('You are currently viewing the possible transitions to and from
         workflow states. The state is shown in the left column; the state to be
         moved to is to the right. For each transition, check the box next to
@@ -79,7 +80,7 @@ function workflow_admin_ui_help($path, $arg) {
         array('!url' => url('admin/people/permissions', array(
           'fragment' => 'module-workflow'))));
 
-    case 'admin/config/workflow/workflow/manage/%/labels':
+    case WORKFLOW_ADMIN_UI_PATH . '/manage/%/labels':
       return t('You can add labels to transitions if you don\'t like the
         standard state labels. They will modify the Workflow form options, so
         specific workflow transitions can have their own labels, relative to
@@ -161,9 +162,9 @@ function workflow_admin_ui_breadcrumbs($workflow, $extra = NULL) {
   $bc = array(l(t('Home'), '<front>'));
   $bc[] = l(t('Configuration'), 'admin/config');
   $bc[] = l(t('Workflow'), 'admin/config/workflow');
-  $bc[] = l(t('Workflow'), 'admin/config/workflow/workflow');
+  $bc[] = l(t('Workflow'), WORKFLOW_ADMIN_UI_PATH);
   if ($workflow) {
-    $bc[] = l($workflow->label(), "admin/config/workflow/workflow/$workflow->wid");
+    $bc[] = l($workflow->label(), WORKFLOW_ADMIN_UI_PATH . "/$workflow->wid");
   }
   if ($extra) {
     $bc[] = $extra;

+ 2 - 2
sites/all/modules/contrib/admin/workflow/workflow_admin_ui/workflow_admin_ui.page.labels.inc

@@ -30,11 +30,11 @@
  * @return array
  *   Array of form items for editing labels on transitions.
  */
-function workflow_admin_ui_labels_form($form, $form_state, $workflow, $op) {
+function workflow_admin_ui_labels_form($form, &$form_state, $workflow, $op) {
   if (!is_object($workflow)) {
     drupal_set_message(t('Improper worklow ID provided.'), 'error');
     watchdog('workflow_named_transitions', 'Improper worklow ID provided.');
-    drupal_goto('admin/config/workflow/workflow');
+    drupal_goto(WORKFLOW_ADMIN_UI_PATH);
   }
 
   $headers = array(

+ 3 - 2
sites/all/modules/contrib/admin/workflow/workflow_admin_ui/workflow_admin_ui.page.permissions.inc

@@ -17,9 +17,10 @@
 function workflow_admin_ui_view_permissions_form($workflow, $op) {
   // If we don't have a workflow at this point, go back to admin page.
   if (!$workflow) {
-    drupal_goto('admin/config/workflow/workflow');
+    drupal_goto(WORKFLOW_ADMIN_UI_PATH);
   }
 
+
   $all = array();
   $roles = workflow_get_roles();
   foreach ($roles as $rid => $value) {
@@ -31,7 +32,7 @@ function workflow_admin_ui_view_permissions_form($workflow, $op) {
     foreach ($transition->roles as $rid) {
       $old_state = $transition->getOldState();
       $new_state = $transition->getNewState();
-      $all[$rid]['transitions'][] = array(check_plain(t($old_state->label())), WORKFLOW_ADMIN_UI_ARROW, check_plain(t($new_state->label())));
+      $all[$rid]['transitions'][] = array($old_state->label(), WORKFLOW_ADMIN_UI_ARROW, $new_state->label());
     }
   }
 

+ 2 - 2
sites/all/modules/contrib/admin/workflow/workflow_admin_ui/workflow_admin_ui.page.states.inc

@@ -59,7 +59,7 @@ function workflow_admin_ui_states_form($form, &$form_state, $workflow, $op) {
         '#type' => 'textfield',
         '#size' => 30,
         '#maxlength' => 255,
-        '#default_value' => check_plain($label),
+        '#default_value' => $label,
       ),
 
       'name' => array(
@@ -305,7 +305,7 @@ function workflow_admin_ui_states_form_submit($form, &$form_state) {
   }
 
   drupal_set_message(t('The workflow was updated.'));
-  // $form_state['redirect'] = 'admin/config/workflow/workflow';
+  // $form_state['redirect'] = WORKFLOW_ADMIN_UI_PATH;
 }
 
 /**

+ 2 - 2
sites/all/modules/contrib/admin/workflow/workflow_admin_ui/workflow_admin_ui.page.transitions.inc

@@ -114,7 +114,7 @@ function theme_workflow_admin_ui_transitions_form($variables) {
       $header = array(array('data' => t('From / To') . ' &nbsp;' . WORKFLOW_ADMIN_UI_ARROW));
       $rows = array();
       foreach ($states as $state) {
-        $label = check_plain($state->label());
+        $label = $state->label();
         // Don't allow transition TO (creation).
         if (!$state->isCreationState()) {
           $header[] = array('data' => $label);
@@ -218,5 +218,5 @@ function workflow_admin_ui_transitions_form_submit($form, &$form_state) {
   }
 
   drupal_set_message(t('The workflow was updated.'));
-  // $form_state['redirect'] = 'admin/config/workflow/workflow';
+  // $form_state['redirect'] = WORKFLOW_ADMIN_UI_PATH;
 }

+ 4 - 3
sites/all/modules/contrib/admin/workflow/workflow_admin_ui/workflow_admin_ui.page.workflow.inc

@@ -221,7 +221,7 @@ function workflow_admin_ui_edit_form_validate($form, &$form_state) {
 
   // Make sure workflow name is not a duplicate.
   foreach (workflow_load_multiple() as $stored_workflow) {
-    if ($name == check_plain($stored_workflow->getName()) && $workflow->wid != $stored_workflow->wid) {
+    if ($name == $stored_workflow->name && $workflow->wid != $stored_workflow->wid) {
       form_set_error('name', t('A workflow with the name %name already exists. Please enter another name for this workflow.',
         array('%name' => $name)));
       break;
@@ -248,6 +248,7 @@ function workflow_admin_ui_edit_form_submit($form, &$form_state) {
     $workflow->tab_roles = array_filter($form_state['values']['tab_roles']);
     $workflow->options = array(
       'name_as_title' => $form_state['values']['name_as_title'],
+      'fieldset' => $form_state['values']['fieldset'],
       'options' => $form_state['values']['options'],
       'schedule' => $form_state['values']['schedule'],
       'schedule_timezone' => $form_state['values']['schedule_timezone'],
@@ -262,7 +263,7 @@ function workflow_admin_ui_edit_form_submit($form, &$form_state) {
   if ($insert) {
     $args = array(
       '%name' => $workflow->getName(),
-      '@url' => url('admin/config/workflow/workflow/edit/' . $workflow->wid),
+      '@url' => url(WORKFLOW_ADMIN_UI_PATH . "/edit/$workflow->wid"),
     );
     watchdog('workflow', 'Created workflow %name', $args);
     drupal_set_message(t('The workflow %name was created. Please maintain the states and transitions.', $args), 'status');
@@ -272,5 +273,5 @@ function workflow_admin_ui_edit_form_submit($form, &$form_state) {
   }
   // This redirect is needed, when changing the workflow name, with name in URL.
   // Also for cloning a workflow.
-  $form_state['redirect'] = 'admin/config/workflow/workflow/manage/' . $workflow->wid;
+  $form_state['redirect'] = WORKFLOW_ADMIN_UI_PATH . "/manage/$workflow->wid";
 }

+ 8 - 7
sites/all/modules/contrib/admin/workflow/workflow_cleanup/workflow_cleanup.info

@@ -1,13 +1,14 @@
 name = Workflow Clean Up
-description = "Cleans up Workflow cruft."
-dependencies[] = workflow
-core = 7.x
+description = Cleans up Workflow cruft.
 package = Workflow
+core = 7.x
+
+dependencies[] = workflow
 
 configure = admin/config/workflow/workflow/cleanup
-; Information added by Drupal.org packaging script on 2017-01-15
-version = "7.x-2.9+10-dev"
+
+; Information added by Drupal.org packaging script on 2019-05-23
+version = "7.x-2.13"
 core = "7.x"
 project = "workflow"
-datestamp = "1484510888"
-
+datestamp = "1558597389"

+ 5 - 2
sites/all/modules/contrib/admin/workflow/workflow_cleanup/workflow_cleanup.module

@@ -1,4 +1,5 @@
 <?php
+
 /**
  * @file
  * Cleans up Workflow cruft that may build up over time.
@@ -10,7 +11,9 @@
 function workflow_cleanup_menu() {
   $items = array();
 
-  $items['admin/config/workflow/workflow/cleanup'] = array(
+  $admin_path = WORKFLOW_ADMIN_UI_PATH;
+
+  $items["$admin_path/cleanup"] = array(
     'title' => 'Clean up workflow',
     'file' => 'workflow_cleanup.pages.inc',
     'access arguments' => array('administer workflow'),
@@ -27,7 +30,7 @@ function workflow_cleanup_menu() {
  */
 function workflow_cleanup_help($path, $arg) {
   switch ($path) {
-    case 'admin/config/workflow/workflow/cleanup':
+    case WORKFLOW_ADMIN_UI_PATH . '/cleanup':
       return t('This page allows you to delete orphaned and inactive states.
         States can be deleted freely in a development environment, but be
         careful if you have used a State in a production environment. The

+ 2 - 2
sites/all/modules/contrib/admin/workflow/workflow_cleanup/workflow_cleanup.pages.inc

@@ -1,13 +1,13 @@
 <?php
 /**
  * @file
- * Contains admin/config/workflow/workflow/cleanup page.
+ * Contains an Admin page to delete obsolete states and transitions.
  */
 
 /**
  * The main cleanup page.
  */
-function workflow_cleanup_form($form, $form_state) {
+function workflow_cleanup_form($form, &$form_state) {
   $form = array();
 
   // Get all of the states, indexed by sid.

+ 29 - 0
sites/all/modules/contrib/admin/workflow/workflow_field/workflowfield.field.inc

@@ -143,6 +143,9 @@ function _workflowfield_metadata_property_set($entity, $name, $value, $langcode,
  */
 function workflowfield_field_formatter_info_alter(&$info) {
   $info['list_default']['field types'][] = 'workflow';
+  if (isset($info['i18n_list_default'])) {
+    $info['i18n_list_default']['field types'][] = 'workflow';
+  }
 }
 
 /**
@@ -312,3 +315,29 @@ function workflowfield_options_list($field, $instance, $entity_type, $entity) {
   }
   return $options;
 }
+
+/**
+ * Implements hook_i18n_field_info().
+ */
+function workflowfield_i18n_field_info() {
+  $info['workflow'] = array(
+    'translate_options' => 'workflowfield_i18n_field_translate_allowed_values',
+  );
+  return $info;
+}
+
+/**
+ * Returns the array of translated allowed values for a workflow (list) field.
+ *
+ * @param $field
+ *   The field definition.
+ *
+ * @return
+ *   The array of allowed values. Keys of the array are the raw stored values
+ *   (number or text), values are the translated, sanitized labels.
+ */
+function workflowfield_i18n_field_translate_allowed_values($field) {
+  // State labels are already translated and sanitized.
+  $workflow_states = workflow_get_workflow_state_names($field['settings']['wid'], $grouped = FALSE, $all = TRUE);
+  return $workflow_states;
+}

+ 3 - 4
sites/all/modules/contrib/admin/workflow/workflow_field/workflowfield.info

@@ -8,9 +8,8 @@ dependencies[] = field
 dependencies[] = options
 dependencies[] = workflow
 
-; Information added by Drupal.org packaging script on 2017-01-15
-version = "7.x-2.9+10-dev"
+; Information added by Drupal.org packaging script on 2019-05-23
+version = "7.x-2.13"
 core = "7.x"
 project = "workflow"
-datestamp = "1484510888"
-
+datestamp = "1558597389"

+ 1 - 1
sites/all/modules/contrib/admin/workflow/workflow_field/workflowfield.module

@@ -16,7 +16,7 @@ require_once dirname(__FILE__) . '/workflowfield.formatter.inc';
  */
 function workflowfield_help($path, $arg) {
   switch ($path) {
-    case 'admin/config/workflow/workflow':
+    case WORKFLOW_ADMIN_UI_PATH:
       return t('This page allows you to maintain Workflows. Once a workflow is
         created, you can maintain your entity type and add a Field of type
         \'Workflow\'.');

+ 3 - 4
sites/all/modules/contrib/admin/workflow/workflow_node/workflownode.info

@@ -5,9 +5,8 @@ core = 7.x
 
 dependencies[] = workflow
 
-; Information added by Drupal.org packaging script on 2017-01-15
-version = "7.x-2.9+10-dev"
+; Information added by Drupal.org packaging script on 2019-05-23
+version = "7.x-2.13"
 core = "7.x"
 project = "workflow"
-datestamp = "1484510888"
-
+datestamp = "1558597389"

+ 1 - 1
sites/all/modules/contrib/admin/workflow/workflow_node/workflownode.tokens.inc

@@ -177,7 +177,7 @@ function workflownode_tokens($type, $tokens, array $data = array(), array $optio
       foreach ($tokens as $name => $original) {
         switch ($name) {
           case 'workflow-name':
-            $replacements[$original] = $sanitize ? check_plain($workflow->label()) : $workflow->label();
+            $replacements[$original] = $workflow->label(); // Already sanitized.
             break;
 
           case 'workflow-current-state-name':

+ 0 - 236
sites/all/modules/contrib/admin/workflow/workflow_notify/workflow_notify.admin.inc

@@ -1,236 +0,0 @@
-<?php
-/**
- * @file
- * Admin UI to Notify roles for Workflow state transitions.
- */
-
-/**
- * Settings form.
- */
-function workflow_notify_settings_form($form, $form_state, $workflow) {
-  // If we don't have a workflow that goes with this, return to the admin pg.
-  if ($workflow) {
-    // Let's get a better page title.
-    drupal_set_title(t('@name Notifications', array('@name' => ucwords($workflow->name))));
-
-    // Let's add some breadcrumbs.
-    workflow_admin_ui_breadcrumbs($workflow);
-
-    $noyes = array(t('No'), t('Yes'));
-
-    $form['wid'] = array('#type' => 'value', '#value' => $workflow->wid);
-    $form['#workflow'] = $workflow;
-
-    // Get all the states for this workflow, except the (creation) state.
-//    $states = workflow_get_workflow_states_by_wid($workflow->wid,
-//      array('status' => 1, 'sysid' => 0));
-    $states = array();
-    foreach ($workflow->states as $sid => $state) {
-      if (!$state->sysid) {
-        $states[$sid] = $state;
-      }
-    }
-    if (!$states) {
-      $form['error'] = array(
-        '#type' => 'markup',
-        '#value' => t('There are no states defined for this workflow.'),
-      );
-      return $form;
-    }
-
-    $form['#states'] = $states;
-
-    // Get all roles, except anonymous.
-    $roles = user_roles(TRUE);
-    $roles = array('-1' => t('Author')) + user_roles(TRUE);
-
-    // The module_invoke_all function does not allow passing by reference.
-    $args = array('roles' => $roles);
-    foreach (module_implements('workflow_notify') as $module) {
-      $function = $module . '_workflow_notify';
-      // Call the $op='roles' hooks so the list may be modified.
-      $function('roles', $args);
-    }
-    // Get the modified list.
-    $roles = $args['roles'];
-
-    // Setting for "from" address.
-    $form['from_address'] = array(
-      '#title' => t('Set "From" address to'),
-      '#type' => 'radios',
-      '#options' => array(
-        'site' => t('Site email address'),
-        'changer' => t('Current user'),
-        ),
-      '#default_value' => variable_get('workflow_notify_from_address_' . $workflow->wid, 'site'),
-      '#attributes' => array('class' => array('container-inline')),
-      '#description' => t('Determines whether to use the site address or the address of the person
-        causing the state change.'),
-      );
-
-    // Get the list of input formats.
-    $formats = array();
-    foreach (filter_formats() as $fid => $filter) {
-      $formats[$fid] = $filter->name;
-    }
-
-    $form['filter'] = array(
-      '#title' => t('Filter format to use on message'),
-      '#type' => 'radios',
-      '#options' => $formats,
-      '#default_value' => variable_get('workflow_notify_filter_format_' . $workflow->wid, 'filtered_html'),
-      '#attributes' => array('class' => array('container-inline')),
-      '#description' => t('The message body will be processed using this filter format
-        in order to ensure security.'),
-      );
-
-    $form['tokens'] = array(
-      '#theme' => 'token_tree_link',
-      '#token_types' => array('node', 'workflow'),
-      );
-
-    // Column names for theme function.
-    $columns = array(
-      'state' => t('State'),
-      'roles' => t('Roles to notify'),
-      );
-
-    $args = array('columns' => $columns);
-    // The module_invoke_all function does not allow passing by reference.
-    foreach (module_implements('workflow_notify') as $module) {
-      $function = $module . '_workflow_notify';
-      $function('columns', $args);
-    }
-    $form['#columns'] = $args['columns'];
-
-    // We always want subject and body last.
-    $form['#columns']['subject'] = t('Subject');
-    $form['#columns']['body'] = t('Body');
-
-    $notify = variable_get('workflow_notify_roles', array());
-
-    foreach ($states as $sid => $state) {
-      // Allow modules to insert state operations.
-      $state_links = module_invoke_all('workflow_operations', 'state', $workflow, $state);
-
-      $form['states'][$sid] = array(
-        'state' => array(
-          '#type' => 'markup',
-          '#markup' => filter_xss($state->state),
-          ),
-
-        'roles' => array(
-          '#type' => 'checkboxes',
-          '#options' => $roles,
-          '#default_value' => (isset($notify[$sid]) ? $notify[$sid] : array()),
-          '#attributes' => array('class' => array('state-roles')),
-          ),
-
-        'subject' => array(
-          '#type' => 'textarea',
-          '#rows' => 5,
-          '#default_value' => variable_get('workflow_notify_subject_' . $sid,
-            '[node:title] is now "[node:field_workflow_state:new-state:label]"'),
-          '#attributes' => array('class' => array('subject')),
-          ),
-
-        'body' => array(
-          '#type' => 'textarea',
-          '#rows' => 5,
-          '#default_value' => variable_get('workflow_notify_body_' . $sid,
-            '<a href="[node:url:absolute]">[node:title]</a> is now "[node:field_workflow_state:new-state:label]".'),
-          '#attributes' => array('class' => array('body')),
-          ),
-        );
-    }
-
-    $form['#tree'] = TRUE;
-    $form['submit'] = array('#type' => 'submit', '#value' => 'Save notifications settings');
-
-    return $form;
-  }
-  else {
-    drupal_goto('admin/config/workflow/workflow');
-  }
-}
-
-/**
- * Theme the settings form.
- */
-function theme_workflow_notify_settings_form($variables) {
-  $form = $variables['form'];
-  $output = '';
-  $table_id = 'workflow-notify-settings';
-
-  $output .= drupal_render($form['from_address']);
-  $output .= drupal_render($form['filter']);
-  $output .= drupal_render($form['tokens']);
-
-  $table = array(
-    'rows' => array(),
-    'header' => array(),    // To be filled in.
-    'attributes' => array('id' => $table_id, 'style' => 'width: 100%; margin-top: 1em;'),
-    );
-
-  $columns = $form['#columns'];
-  $colspan = count($columns);
-
-  foreach ($columns as $field => $title) {
-    $table['header'][] = $title;
-  }
-
-  // Iterate over each element in our $form['states'] array
-  foreach (element_children($form['states']) as $id) {
-    // We are now ready to add each element of our $form data to the rows
-    // array, so that they end up as individual table cells when rendered
-    // in the final table.
-    $row = array();
-
-    foreach ($columns as $field => $title) {
-      $row[] = array(
-        'data' => drupal_render($form['states'][$id][$field]),
-        'class' => array(drupal_html_class($field)),
-        );
-    }
-
-    // Put the data row into the table.
-    $table['rows'][] = array('data' => $row);
-  }
-
-  $output .= theme('table', $table);
-
-  $output .= drupal_render($form['explain']);
-
-  // And then render any remaining form elements (such as our submit button)
-  $output .= drupal_render_children($form);
-
-  return $output;
-}
-
-function workflow_notify_settings_form_submit($form, $form_state) {
-  $roles = variable_get('workflow_notify_roles', array());
-
-  $workflow = $form['#workflow'];
-
-  variable_set('workflow_notify_from_address_' . $workflow->wid , $form_state['values']['from_address']);
-  variable_set('workflow_notify_filter_format_' . $workflow->wid , $form_state['values']['filter']);
-
-  foreach ($form_state['values']['states'] as $sid => $values) {
-    $selected = array_filter($values['roles']);
-    // Are there any roles selected?
-    if ($selected) {
-      $roles[$sid] = $selected;
-    }
-    else {
-      // No, so make sure this state is gone.
-      unset($roles[$sid]);
-    }
-
-    variable_set("workflow_notify_subject_$sid", $values['subject']);
-    variable_set("workflow_notify_body_$sid", $values['body']);
-  }
-
-  variable_set('workflow_notify_roles', $roles);
-
-  drupal_set_message(t('The notification settings have been saved.'));
-}

+ 7 - 7
sites/all/modules/contrib/admin/workflow/workflow_notify/workflow_notify.info

@@ -1,15 +1,15 @@
 name = Workflow Notify
 description = Notify roles of Workflow transitions.
-dependencies[] = workflow
-configure = admin/config/workflow/workflow
-core = 7.x
 package = Workflow
+core = 7.x
 
 dependencies[] = token
+dependencies[] = workflow
+
+configure = admin/config/workflow/workflow
 
-; Information added by Drupal.org packaging script on 2017-01-15
-version = "7.x-2.9+10-dev"
+; Information added by Drupal.org packaging script on 2019-05-23
+version = "7.x-2.13"
 core = "7.x"
 project = "workflow"
-datestamp = "1484510888"
-
+datestamp = "1558597389"

+ 118 - 67
sites/all/modules/contrib/admin/workflow/workflow_notify/workflow_notify.module

@@ -1,10 +1,66 @@
 <?php
+
 /**
  * @file
  * Notify roles for Workflow state transitions.
  */
 
 /**
+ * Implements hook_menu().
+ */
+function workflow_notify_menu() {
+  $items = array();
+
+  $admin_path = WORKFLOW_ADMIN_UI_PATH;
+  $id_count = count(explode('/', $admin_path));
+
+  $items["$admin_path/manage/%workflow/notify"] = array(
+    'title' => 'Notifications',
+    'file' => 'workflow_notify.pages.inc',
+    'access arguments' => array('administer workflow'),
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('workflow_notify_settings_form', $id_count + 1),
+    'type' => MENU_CALLBACK,
+  );
+
+  return $items;
+}
+
+/**
+ * Implements hook_workflow_operations().
+ */
+function workflow_notify_workflow_operations($op, Workflow $workflow = NULL) {
+  $admin_path = WORKFLOW_ADMIN_UI_PATH;
+
+  switch ($op) {
+    case 'workflow':
+      $actions = array();
+      if ($workflow && $workflow->getStates()) {
+        $wid = $workflow->getWorkflowId();
+        $alt = t('Notify users about state changes.');
+        $actions = array(
+          'workflow_notify_settings' => array(
+            'title' => t('Notifications'),
+            'href' => "$admin_path/manage/$wid/notify",
+            'attributes' => array('alt' => $alt, 'title' => $alt),
+          ),
+        );
+      }
+      else {
+        // Generate a dummy, if no states exist.
+        $actions = array(
+          'workflow_notify_settings' => array(
+            'title' => '',
+            'href' => '',
+          ),
+        );
+      }
+
+      return $actions;
+  }
+}
+
+/**
  * Implements hook_permission().
  */
 function workflow_notify_permission() {
@@ -21,37 +77,19 @@ function workflow_notify_permission() {
  */
 function workflow_notify_help($path, $arg) {
   switch ($path) {
-    case 'admin/config/workflow/workflow/notify/%':
+    case WORKFLOW_ADMIN_UI_PATH . '/notify/%':
       return '<p>' . t('The selected roles will be notified of each state change selected.') . '</p>';
   }
 }
 
 /**
- * Implements hook_menu().
- */
-function workflow_notify_menu() {
-  $items = array();
-
-  $items['admin/config/workflow/workflow/notify/%workflow'] = array(
-    'title' => 'Notifications',
-    'access arguments' => array('administer workflow'),
-    'page callback' => 'drupal_get_form',
-    'page arguments' => array('workflow_notify_settings_form', 5),
-    'type' => MENU_CALLBACK,
-    'file' => 'workflow_notify.admin.inc',
-  );
-
-  return $items;
-}
-
-/**
  * Implements hook_theme().
  */
 function workflow_notify_theme() {
   return array(
     'workflow_notify_settings_form' => array(
       'render element' => 'form',
-      'file' => 'workflow_notify.admin.inc',
+      'file' => 'workflow_notify.pages.inc',
     ),
   );
 }
@@ -67,30 +105,6 @@ function workflow_notify_hook_info() {
 }
 
 /**
- * Implements hook_workflow_operations().
- * Add an action link to this module.
- */
-function workflow_notify_workflow_operations($op, $workflow = NULL) {
-  switch ($op) {
-    case 'workflow':
-      $wid = $workflow->getWorkflowId();
-
-      $actions = array(
-        'workflow_notify_settings' => array(
-          'title' => t('Notifications'),
-          'href' => "admin/config/workflow/workflow/notify/$wid",
-          'attributes' => array('alt' => t('Notify users about state changes.')),
-        ),
-      );
-
-      $actions['workflow_notify_settings']['attributes']['title'] =
-        $actions['workflow_notify_settings']['attributes']['alt'];
-
-      return $actions;
-  }
-}
-
-/**
  * Implements hook_workflow().
  * Calls drupal_mail via _workflow_notify() for Workflow Field;
  *
@@ -119,6 +133,17 @@ function workflow_notify_workflow($op, $old_state, $new_state, $entity, $force,
 }
 
 /**
+ * Implements hook_entity_insert().
+ * Calls drupal_mail via _workflow_notify() for Workflow Field;
+ *
+ * @param $entity
+ * @param $entity_type
+ */
+function workflow_notify_entity_insert($entity, $entity_type) {
+  _workflow_notify_entity_update($entity, $entity_type);
+}
+
+/**
  * Implements hook_entity_update().
  * Calls drupal_mail via _workflow_notify() for Workflow Field;
  *
@@ -126,6 +151,16 @@ function workflow_notify_workflow($op, $old_state, $new_state, $entity, $force,
  * @param $entity_type
  */
 function workflow_notify_entity_update($entity, $entity_type) {
+  _workflow_notify_entity_update($entity, $entity_type);
+}
+
+/**
+ * Calls drupal_mail via _workflow_notify() for Workflow Field;
+ *
+ * @param $entity
+ * @param $entity_type
+ */
+function _workflow_notify_entity_update($entity, $entity_type) {
   if (isset($entity->workflow_transitions)) {
     $new_state = workflow_node_current_state($entity, $entity_type, $field_name);
     foreach ($entity->workflow_transitions as $field_name => &$transition) {
@@ -146,6 +181,11 @@ function workflow_notify_mail($key, &$message, $params) {
       $filter = $params['filter'];
       $message['send'] = TRUE;
 
+      $entity_type = $params['data']['entity_type'];
+      $entity = isset($params['data']['entity']) ? $params['data']['entity'] : $params['data']['node'];
+      $entity_uri = entity_uri($entity_type, $entity);
+      list($entity_id, , $entity_bundle) = entity_extract_ids($entity_type, $entity);
+
       $message['subject'] = filter_xss(token_replace($params['context']['subject'], $params['data'], $params));
       $message['body'][] = check_markup(token_replace($params['context']['body'], $params['data'], $params), $filter);
 
@@ -156,12 +196,11 @@ function workflow_notify_mail($key, &$message, $params) {
           '@to' => $message['to'],
           '@from' => $message['from'],
         ),
-        WATCHDOG_INFO, l(t('view'), 'node/' . $params['data']['node']->nid));
+        WATCHDOG_INFO, l(t('view'), $entity_uri['path']));
       return;
   }
 }
 
-
 /**
  * Calls drupal_mail() to notify users.
  *
@@ -188,12 +227,13 @@ function _workflow_notify($new_state, $entity, $entity_type = '', $field_name =
 
   // Okay, we are notifying someone of this change.
   // So let's get the workflow object.
+  $entity_uri = entity_uri($entity_type, $entity);
   list($entity_id, , $entity_bundle) = entity_extract_ids($entity_type, $entity);
   /* @var $workflow Workflow */
   $workflow = workflow_get_workflows_by_type($entity_bundle, $entity_type);
   $wid = $workflow->getWorkflowId();
 
-    // And all the states.
+  // And all the states.
   $states = $workflow->getStates(TRUE);
 
   // Get the specific roles to notify.
@@ -212,7 +252,8 @@ function _workflow_notify($new_state, $entity, $entity_type = '', $field_name =
       . "WHERE ur.rid IN (:rids) "
       . "AND u.status = 1 ";
     $users = db_query($query, array(':rids' => $notify))->fetchCol();
-  } else {
+  }
+  else {
     $users = array();
   }
 
@@ -227,13 +268,13 @@ function _workflow_notify($new_state, $entity, $entity_type = '', $field_name =
   // Call all modules that want to limit the list.
   $args = array(
     'users' => $accounts,
-    'node' => $entity,
-    'entity' => $entity, // Preparing for entities, keeping backward compatibility.
     'entity_type' => $entity_type,
     'state' => $new_state,
     'roles' => $notify,
     'workflow' => $workflow,
   );
+  // Preparing for entities, keeping backward compatibility.
+  $args += $entity_type == 'node' ? array('node' => $entity) : array('entity' => $entity);
   foreach (module_implements('workflow_notify') as $module) {
     $function = $module . '_workflow_notify';
     $function('users', $args);
@@ -241,40 +282,42 @@ function _workflow_notify($new_state, $entity, $entity_type = '', $field_name =
 
   // Retrieve the remaining list without duplicates.
   $accounts = $args['users'];
-  $addr_list = array();
-
   // Just quit if there are no users.
   if (empty($accounts)) {
     watchdog('workflow_notify', 'No recipients - email skipped.', array(),
-      WATCHDOG_DEBUG, l(t('view'), 'node/' . $entity_id)); // @todo: other entity types.
+      WATCHDOG_DEBUG, l(t('view'), $entity_uri['path']));
     return;
   }
-
+  $addr_list = array();
   foreach ($accounts as $uid => $account) {
-    $addr_list[] = format_username($account) . '<' . $account->mail . '>';
+    $addr_list[] = format_username($account) . ' <' . $account->mail . '>';
   }
+  // The to-parameter to drupal_mail is a string, not an array, separated by commas.
+  $to = implode(', ', $addr_list);
 
+  // Retrieve the params parameter for drupal_mail.
   $params = array(
     'clear' => TRUE,
     'sanitize' => FALSE,
     'data' => array(
-      'node' => $entity,
-      'entity' => $entity, // Preparing for entities, keeping backward compatibility.
-      'entity_type' => $entity_type,
       'user' => $user,
+      'entity_type' => $entity_type,
     ),
     'filter' => variable_get('workflow_notify_filter_format_' . $wid, 'filtered_html'),
   );
+  // Preparing for entities, keeping backward compatibility.
+  $params['data'] += $entity_type == 'node' ? array('node' => $entity) : array('entity' => $entity);
 
   // Build the subject and body of the mail.
   // Token replacement occurs in hook_mail().
-  // @TODO: Currently no translation occurs.
+  // @todo: Currently no translation occurs.
   $params['context']['subject'] = variable_get("workflow_notify_subject_$new_state",
     '[node:title] is now "[workflow:workflow-current-state-name]"');
 
   $params['context']['body'] = variable_get("workflow_notify_body_$new_state",
     '<a href="[node:url:absolute]">[node:title]</a> is now "@state".');
 
+  // Retrieve the from-address.
   switch (variable_get('workflow_notify_from_address_' . $wid, 'site')) {
     case 'site':
       $from = variable_get('site_mail', ini_get('sendmail_from'));
@@ -285,13 +328,21 @@ function _workflow_notify($new_state, $entity, $entity_type = '', $field_name =
       break;
   }
 
-  // Send the email.
-  drupal_mail('workflow_notify',
-    'workflow_notify',
-    implode(', ', $addr_list),
-    language_default(),
-    $params,
-    $from);
+  // Send the mail, and check for success. Note that this does not guarantee
+  // message delivery; only that there were no PHP-related issues encountered
+  // while sending.
+  $module = 'workflow_notify';
+  $key = 'workflow_notify';
+  $language = language_default();
+  // https://api.drupal.org/api/drupal/includes!mail.inc/function/drupal_mail/7.x
+  $result = drupal_mail($module, $key, $to, $language, $params, $from);
+  /*
+  if ($result['result'] == TRUE) {
+    drupal_set_message(t('Your message has been sent.'));
+  }
+  else {
+    drupal_set_message(t('There was a problem sending your message and it was not sent.'), 'error');
+  }
+   */
 
-  return;
 }

+ 230 - 0
sites/all/modules/contrib/admin/workflow/workflow_notify/workflow_notify.pages.inc

@@ -0,0 +1,230 @@
+<?php
+
+/**
+ * @file
+ * Admin UI to Notify roles for Workflow state transitions.
+ */
+
+/**
+ * Settings form.
+ */
+function workflow_notify_settings_form($form, &$form_state, Workflow $workflow) {
+  // If we don't have a workflow that goes with this, return to the admin pg.
+  if (!is_object($workflow)) {
+    drupal_set_message(t('Improper worklow ID provided.'), 'error');
+    drupal_goto(WORKFLOW_ADMIN_UI_PATH);
+  }
+
+  // @todo: Let's get a better page title.
+  drupal_set_title(t('@name Notifications', array('@name' => $workflow->label())));
+
+  // Let's add some breadcrumbs.
+ // workflow_admin_ui_breadcrumbs($workflow);
+
+  $form['#tree'] = TRUE;
+  $form['#wid'] = $wid = $workflow->getWorkflowId();
+  $form['#workflow'] = $workflow;
+
+  $noyes = array(t('No'), t('Yes'));
+
+  // Get all the states for this workflow, except the (creation) state.
+  $states = $workflow->getStates();
+  $form['#states'] = $states;
+  if (!$states) {
+    $form['#columns'] = array();
+    $form['error'] = array(
+      '#type' => 'markup',
+      '#value' => t('There are no states defined for this workflow.'),
+    );
+    return $form;
+  }
+
+  // A list of role names keyed by role ID, including the 'author' role.
+  $roles = workflow_get_roles('participate in workflow');
+  // The module_invoke_all function does not allow passing by reference.
+  $args = array('roles' => $roles);
+  foreach (module_implements('workflow_notify') as $module) {
+    $function = $module . '_workflow_notify';
+    // Call the $op='roles' hooks so the list may be modified.
+    $function('roles', $args);
+  }
+  // Get the modified list.
+  $roles = $args['roles'];
+
+  // Setting for "from" address.
+  $form['from_address'] = array(
+    '#title' => t('Set "From" address to'),
+    '#type' => 'radios',
+    '#options' => array(
+      'site' => t('Site email address'),
+      'changer' => t('Current user'),
+    ),
+    '#default_value' => variable_get("workflow_notify_from_address_$wid", 'site'),
+    '#attributes' => array('class' => array('container-inline')),
+    '#description' => t('Determines whether to use the site address or the address of the person
+        causing the state change.'),
+  );
+
+  // Get the list of input formats.
+  $formats = array();
+  foreach (filter_formats() as $fid => $filter) {
+    $formats[$fid] = $filter->name;
+  }
+
+  $form['filter'] = array(
+    '#title' => t('Filter format to use on message'),
+    '#type' => 'radios',
+    '#options' => $formats,
+    '#default_value' => variable_get("workflow_notify_filter_format_$wid", 'filtered_html'),
+    '#attributes' => array('class' => array('container-inline')),
+    '#description' => t('The message body will be processed using this filter format
+        in order to ensure security.'),
+  );
+
+  $form['tokens'] = array(
+    '#theme' => 'token_tree_link',
+    '#token_types' => array('node', 'workflow'),
+  );
+
+  // Column names for theme function.
+  $columns = array(
+    'state' => t('State'),
+    'roles' => t('Roles to notify'),
+  );
+
+  $args = array('columns' => $columns);
+  // The module_invoke_all function does not allow passing by reference.
+  foreach (module_implements('workflow_notify') as $module) {
+    $function = $module . '_workflow_notify';
+    $function('columns', $args);
+  }
+  $form['#columns'] = $args['columns'];
+
+  // We always want subject and body last.
+  $form['#columns']['subject'] = t('Subject');
+  $form['#columns']['body'] = t('Body');
+
+  $notify = variable_get('workflow_notify_roles', array());
+
+  foreach ($states as $sid => $state) {
+    // Allow modules to insert state operations.
+    $state_links = module_invoke_all('workflow_operations', 'state', $workflow, $state);
+
+    $form['states'][$sid] = array(
+      'state' => array(
+        '#type' => 'markup',
+        '#markup' => filter_xss($state->state),
+      ),
+
+      'roles' => array(
+        '#type' => 'checkboxes',
+        '#options' => $roles,
+        '#default_value' => (isset($notify[$sid]) ? $notify[$sid] : array()),
+        '#attributes' => array('class' => array('state-roles')),
+      ),
+
+      'subject' => array(
+        '#type' => 'textarea',
+        '#rows' => 5,
+        '#default_value' => variable_get('workflow_notify_subject_' . $sid,
+          '[node:title] is now "[node:field_workflow_state:new-state:label]"'),
+        '#attributes' => array('class' => array('subject')),
+      ),
+
+      'body' => array(
+        '#type' => 'textarea',
+        '#rows' => 5,
+        '#default_value' => variable_get('workflow_notify_body_' . $sid,
+          '<a href="[node:url:absolute]">[node:title]</a> is now "[node:field_workflow_state:new-state:label]".'),
+        '#attributes' => array('class' => array('body')),
+      ),
+    );
+  }
+
+  $form['submit'] = array('#type' => 'submit', '#value' => t('Save configuration'));
+
+  return $form;
+}
+
+/**
+ * Theme the settings form.
+ */
+function theme_workflow_notify_settings_form($variables) {
+  $form = $variables['form'];
+  $output = '';
+  $table_id = 'workflow-notify-settings';
+
+  $output .= drupal_render($form['from_address']);
+  $output .= drupal_render($form['filter']);
+  $output .= drupal_render($form['tokens']);
+
+  $table = array(
+    'rows' => array(),
+    'header' => array(),    // To be filled in.
+    'attributes' => array('id' => $table_id, 'style' => 'width: 100%; margin-top: 1em;'),
+  );
+
+  $columns = $form['#columns'];
+  $colspan = count($columns);
+
+  foreach ($columns as $field => $title) {
+    $table['header'][] = $title;
+  }
+
+  // Iterate over each element in our $form['states'] array
+  foreach (element_children($form['states']) as $id) {
+    // We are now ready to add each element of our $form data to the rows
+    // array, so that they end up as individual table cells when rendered
+    // in the final table.
+    $row = array();
+
+    foreach ($columns as $field => $title) {
+      $row[] = array(
+        'data' => drupal_render($form['states'][$id][$field]),
+        'class' => array(drupal_html_class($field)),
+      );
+    }
+
+    // Put the data row into the table.
+    $table['rows'][] = array('data' => $row);
+  }
+
+  $output .= theme('table', $table);
+
+  $output .= drupal_render($form['explain']);
+
+  // And then render any remaining form elements (such as our submit button)
+  $output .= drupal_render_children($form);
+
+  return $output;
+}
+
+function workflow_notify_settings_form_submit($form, &$form_state) {
+  $wid = $form['#wid'];
+  $workflow = $form['#workflow'];
+  $roles = variable_get('workflow_notify_roles', array());
+
+  $form_state['redirect'] = WORKFLOW_ADMIN_UI_PATH;
+
+  variable_set("workflow_notify_from_address_$wid" , $form_state['values']['from_address']);
+  variable_set("workflow_notify_filter_format_$wid" , $form_state['values']['filter']);
+
+  foreach ($form_state['values']['states'] as $sid => $values) {
+    $selected = array_filter($values['roles']);
+    // Are there any roles selected?
+    if ($selected) {
+      $roles[$sid] = $selected;
+    }
+    else {
+      // No, so make sure this state is gone.
+      unset($roles[$sid]);
+    }
+
+    variable_set("workflow_notify_subject_$sid", $values['subject']);
+    variable_set("workflow_notify_body_$sid", $values['body']);
+  }
+
+  variable_set('workflow_notify_roles', $roles);
+
+  drupal_set_message(t('The notification settings have been saved.'));
+}

+ 8 - 6
sites/all/modules/contrib/admin/workflow/workflow_notify/workflow_notify_og/workflow_notify_og.info

@@ -1,12 +1,14 @@
 name = Workflow Notify OG
 description = Notify roles by OG groups of Workflow transitions.
-dependencies[] = workflow_notify
-core = 7.x
 package = Workflow
+core = 7.x
 
-; Information added by Drupal.org packaging script on 2017-01-15
-version = "7.x-2.9+10-dev"
+dependencies[] = workflow_notify
+
+configure = admin/config/workflow/workflow
+
+; Information added by Drupal.org packaging script on 2019-05-23
+version = "7.x-2.13"
 core = "7.x"
 project = "workflow"
-datestamp = "1484510888"
-
+datestamp = "1558597389"

+ 14 - 13
sites/all/modules/contrib/admin/workflow/workflow_notify/workflow_notify_og/workflow_notify_og.module

@@ -1,4 +1,5 @@
 <?php
+
 /**
  * @file
  * Notify roles by OG Groups for Workflow state transitions.
@@ -6,6 +7,7 @@
 
 /**
  * Implements hook_workflow_notify().
+ *
  * @param $op - The operation (columns, users).
  * @param $args - The arguments for this call.
  *    - may be:
@@ -73,25 +75,26 @@ function workflow_notify_og_workflow_notify($op, &$args) {
 
 /**
  * Implements hook_form_alter().
+ *
  * Add a column for limiting user groups by OG group.
  */
 function workflow_notify_og_form_alter(&$form, &$form_state, $form_id) {
   switch($form_id) {
     case 'workflow_notify_settings_form':
       $limit = variable_get('workflow_notify_og', array());
-
-      // Add a group limit flag to each state.
-      foreach ($form['states'] as $sid => $element) {
-        $form['states'][$sid]['limit_by_group'] = array(
-          '#type' => 'radios',
-          '#options' => array(t('No'), t('Yes')),
-          '#attributes' => array('class' => array('limit-by-group')),
-          '#default_value' => (isset($limit[$sid]) ? $limit[$sid] : 0),
+      if (!empty($form['states'])) {
+        // Add a group limit flag to each state.
+        foreach ($form['states'] as $sid => $element) {
+          $form['states'][$sid]['limit_by_group'] = array(
+            '#type' => 'radios',
+            '#options' => array(t('No'), t('Yes')),
+            '#attributes' => array('class' => array('limit-by-group')),
+            '#default_value' => (isset($limit[$sid]) ? $limit[$sid] : 0),
           );
+        }
+        // Add our submission handler.
+        $form['#submit'][] = 'workflow_notify_og_form_submit';
       }
-
-      // Add our submission handler.
-      $form['#submit'][] = 'workflow_notify_og_form_submit';
   }
 }
 
@@ -109,6 +112,4 @@ function workflow_notify_og_form_submit(&$form, &$form_state) {
 
   // Save the new limit flags.
   variable_set('workflow_notify_og', $limit);
-
-  $form_state['redirect'] = "admin/config/workflow/workflow/$workflow->wid";
 }

+ 7 - 7
sites/all/modules/contrib/admin/workflow/workflow_revert/workflow_revert.info

@@ -1,12 +1,12 @@
 name = Workflow Revert
-description = "Adds a 'Revert' link to the first workflow history row."
-dependencies[] = workflow
-core = 7.x
+description = Adds a 'Revert' link to the first workflow history row.
 package = Workflow
+core = 7.x
 
-; Information added by Drupal.org packaging script on 2017-01-15
-version = "7.x-2.9+10-dev"
+dependencies[] = workflow
+
+; Information added by Drupal.org packaging script on 2019-05-23
+version = "7.x-2.13"
 core = "7.x"
 project = "workflow"
-datestamp = "1484510888"
-
+datestamp = "1558597389"

+ 2 - 2
sites/all/modules/contrib/admin/workflow/workflow_revert/workflow_revert.pages.inc

@@ -9,7 +9,7 @@
  *
  * @todo: add support for Field in workflow_revert.
  */
-function workflow_revert_form($form, $form_state, $entity_type, $id, $field_name, $previous_sid = NULL) {
+function workflow_revert_form($form, &$form_state, $entity_type, $id, $field_name, $previous_sid = NULL) {
   $entity = entity_load_single($entity_type, $id);
   $uri = entity_uri($entity_type, $entity);
   $return_uri = $uri['path'] . '/workflow';
@@ -45,7 +45,7 @@ function workflow_revert_form($form, $form_state, $entity_type, $id, $field_name
  *
  * The function is magically called, due to its name <form>_submit.
  */
-function workflow_revert_form_submit($form, $form_state) {
+function workflow_revert_form_submit($form, &$form_state) {
   global $user;
 
   $previous_sid = $form['#previous_sid'];

+ 5 - 6
sites/all/modules/contrib/admin/workflow/workflow_rules/workflow_rules.info

@@ -1,16 +1,15 @@
 name = Workflow Rules
 description = Provides additional, workflow-specific Rules integration.
-core = 7.x
 package = Workflow
+core = 7.x
 
-dependencies[] = workflow
 dependencies[] = rules
+dependencies[] = workflow
 
 configure = admin/config/workflow/rules
 
-; Information added by Drupal.org packaging script on 2017-01-15
-version = "7.x-2.9+10-dev"
+; Information added by Drupal.org packaging script on 2019-05-23
+version = "7.x-2.13"
 core = "7.x"
 project = "workflow"
-datestamp = "1484510888"
-
+datestamp = "1558597389"

+ 8 - 8
sites/all/modules/contrib/admin/workflow/workflow_search_api/workflow_search_api.info

@@ -1,14 +1,14 @@
 name = Workflow Node Search API
-description = "Adds Workflow Node's state information to Search API index."
+description = Adds Workflow Node's state information to Search API index.
+package = Workflow
+core = 7.x
+
+dependencies[] = entity
 dependencies[] = workflow
 dependencies[] = workflownode
-dependencies[] = entity
-core = 7.x
-package = Workflow
 
-; Information added by Drupal.org packaging script on 2017-01-15
-version = "7.x-2.9+10-dev"
+; Information added by Drupal.org packaging script on 2019-05-23
+version = "7.x-2.13"
 core = "7.x"
 project = "workflow"
-datestamp = "1484510888"
-
+datestamp = "1558597389"

+ 5 - 7
sites/all/modules/contrib/admin/workflow/workflow_vbo/workflow_vbo.info

@@ -2,15 +2,13 @@ name = Workflow Actions
 description = "Provides actions that can be associated to triggers, or
                used as VBO-action. Provided actions are 'set to next state'
                and 'set to specific state'."
-
-dependencies[] = workflow
-
 package = Workflow
 core = 7.x
 
-; Information added by Drupal.org packaging script on 2017-01-15
-version = "7.x-2.9+10-dev"
+dependencies[] = workflow
+
+; Information added by Drupal.org packaging script on 2019-05-23
+version = "7.x-2.13"
 core = "7.x"
 project = "workflow"
-datestamp = "1484510888"
-
+datestamp = "1558597389"

+ 1 - 1
sites/all/modules/contrib/admin/workflow/workflow_views/handlers/workflow_views_handler_field_state.inc

@@ -11,7 +11,7 @@
 class workflow_views_handler_field_state extends views_handler_field {
 
   function render($values) {
-    return t($values->{$this->field_alias});
+    return t('@alias', array('@alias' => $values->{$this->field_alias}));
   }
 
 }

+ 3 - 4
sites/all/modules/contrib/admin/workflow/workflow_views/workflow_views.info

@@ -14,9 +14,8 @@ files[] = handlers/workflow_views_handler_field_node_link_workflow.inc
 files[] = handlers/workflow_views_handler_field_comment_link_edit.inc
 files[] = handlers/workflow_views_handler_argument_state.inc
 
-; Information added by Drupal.org packaging script on 2017-01-15
-version = "7.x-2.9+10-dev"
+; Information added by Drupal.org packaging script on 2019-05-23
+version = "7.x-2.13"
 core = "7.x"
 project = "workflow"
-datestamp = "1484510888"
-
+datestamp = "1558597389"

+ 39 - 0
sites/all/modules/contrib/files/imagecache_actions/CHANGELOG.txt

@@ -4,6 +4,45 @@ Imagecache Actions
 Imagecache Actions 7.x-1.x-dev
 ------------------------------
 
+Imagecache Actions 7.x-1.12
+---------------------------
+- [#3151871]: by DamienMcKenna: EXIF autorotate support for remote images.
+- [#3117901] by jacob.embree: Curly brace syntax for accessing array elements and
+  string offsets has been deprecated in PHP 7.4.
+
+Imagecache Actions 7.x-1.11
+---------------------------
+- [#3072639]: PDOException: SQLSTATE[HY000]: General error: 25 bind or column
+  index out of range: INSERT INTO {menu_router}.
+
+Imagecache Actions 7.x-1.10
+---------------------------
+- Use json for exporting image styles.
+- [#2988487] by AdamEvertsson: Minor spelling error.
+
+Imagecache Actions 7.x-1.9
+--------------------------
+- [#2760121] by lebster, fietserwin: Add a "Perspective" effect.
+- [#2947014]: PHP 7.2 warning that each() has been deprecated.
+
+Imagecache Actions 7.x-1.8
+--------------------------
+- [#2917097]: PHP 7.1 Warning "A non-numeric value encountered".
+- [#2905130] by bserem, fietserwin: Remove animation from moving images.
+- [#2888678] by das-peter: ImageMagick: Add support for invert effect.
+- [#1099300]: Notice: A non well formed numeric value encountered in
+  image_gd_definecanvas() (line 381 of canvasactions.inc).
+- [#2719661] by SKAUGHT: Division by zero.
+- [#2717789]: Prevent exif_read_data() warnings.
+- Warning: Theme hook coloractions_invert_summary not found.
+- [#2696225] by mnlund, fietserwin: Add support for multiply color blending.
+- by fietserwin: image_styles_admin: sort image styles by label.
+- [#2039379]: Add some better examples for using custom actions.
+- Made more contextual information (image style and image effect) available in
+  the custom action and text image effects.
+- [#2690337] by Ajithlal, fietserwin: Would like a feature for converting case
+  in text effect.
+
 Imagecache Actions 7.x-1.7
 --------------------------
 - [#2671526]: Fatal error on image style flush when image styles are defined in

+ 3 - 4
sites/all/modules/contrib/files/imagecache_actions/autorotate/imagecache_autorotate.info

@@ -5,9 +5,8 @@ core = 7.x
 
 dependencies[] = image
 
-; Information added by Drupal.org packaging script on 2016-02-19
-version = "7.x-1.7"
+; Information added by Drupal.org packaging script on 2020-06-16
+version = "7.x-1.12"
 core = "7.x"
 project = "imagecache_actions"
-datestamp = "1455872655"
-
+datestamp = "1592294437"

+ 33 - 3
sites/all/modules/contrib/files/imagecache_actions/autorotate/imagecache_autorotate.module

@@ -129,7 +129,32 @@ function image_gd_imagecache_autorotate(stdClass $image) {
     watchdog('imagecache_actions', 'Image %file could not be auto-rotated: !message', array('%file' => $image->source, '!message' => t('The exif_read_data() function is not available in this PHP installation. You probably have to enable the exif extension.')));
     return FALSE;
   }
-  $exif = exif_read_data(drupal_realpath($image->source));
+
+  // Read and check result.
+  $path = drupal_realpath($image->source);
+  if ($path) {
+    $exif = @exif_read_data($path);
+  }
+  else {
+    // drupal_realpath and exif fail for remote file systems like S3.
+    // Copy to a local temporary folder and retry.
+    $base = drupal_basename($image->source);
+    $uniq = md5(microtime() . $image->source);
+    $path = file_directory_temp() . '/' . $uniq . '-' . $base;
+    file_unmanaged_copy($image->source, $path);
+    $exif = @exif_read_data($path);
+
+    // Cleanup so we don't leave files behind.
+    // The server would get them later on a reboot, but who knows when that
+    // would be.
+    file_unmanaged_delete($path);
+  }