diff --git a/sites/all/modules/contrib/admin/workflow/includes/Entity/Workflow.php b/sites/all/modules/contrib/admin/workflow/includes/Entity/Workflow.php
index 3356ebd9..9964f0ff 100644
--- a/sites/all/modules/contrib/admin/workflow/includes/Entity/Workflow.php
+++ b/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 settings 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;
}
}
diff --git a/sites/all/modules/contrib/admin/workflow/includes/Entity/WorkflowConfigTransition.php b/sites/all/modules/contrib/admin/workflow/includes/Entity/WorkflowConfigTransition.php
index 08977d85..edf39c00 100644
--- a/sites/all/modules/contrib/admin/workflow/includes/Entity/WorkflowConfigTransition.php
+++ b/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); }
+ }
+
+
}
/**
diff --git a/sites/all/modules/contrib/admin/workflow/includes/Entity/WorkflowInterface.php b/sites/all/modules/contrib/admin/workflow/includes/Entity/WorkflowInterface.php
index c00b1d2d..c65e3cd1 100644
--- a/sites/all/modules/contrib/admin/workflow/includes/Entity/WorkflowInterface.php
+++ b/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[]
*/
diff --git a/sites/all/modules/contrib/admin/workflow/includes/Entity/WorkflowState.php b/sites/all/modules/contrib/admin/workflow/includes/Entity/WorkflowState.php
index 5de63563..edd89a3e 100644
--- a/sites/all/modules/contrib/admin/workflow/includes/Entity/WorkflowState.php
+++ b/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() {
diff --git a/sites/all/modules/contrib/admin/workflow/includes/Entity/WorkflowTransition.php b/sites/all/modules/contrib/admin/workflow/includes/Entity/WorkflowTransition.php
index 41389a1f..00ad1662 100644
--- a/sites/all/modules/contrib/admin/workflow/includes/Entity/WorkflowTransition.php
+++ b/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']));
diff --git a/sites/all/modules/contrib/admin/workflow/includes/Field/WorkflowItem.php b/sites/all/modules/contrib/admin/workflow/includes/Field/WorkflowItem.php
index 81c0205a..6529cf8f 100644
--- a/sites/all/modules/contrib/admin/workflow/includes/Field/WorkflowItem.php
+++ b/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;
}
diff --git a/sites/all/modules/contrib/admin/workflow/includes/Form/WorkflowTransitionForm.php b/sites/all/modules/contrib/admin/workflow/includes/Form/WorkflowTransitionForm.php
index f01f8d45..53a2983c 100644
--- a/sites/all/modules/contrib/admin/workflow/includes/Form/WorkflowTransitionForm.php
+++ b/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;
}
diff --git a/sites/all/modules/contrib/admin/workflow/workflow.deprecated.inc b/sites/all/modules/contrib/admin/workflow/workflow.deprecated.inc
index 7cef005c..f43fdfa4 100644
--- a/sites/all/modules/contrib/admin/workflow/workflow.deprecated.inc
+++ b/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;
}
/**
diff --git a/sites/all/modules/contrib/admin/workflow/workflow.entity.inc b/sites/all/modules/contrib/admin/workflow/workflow.entity.inc
index 0fc64492..8c5abff5 100644
--- a/sites/all/modules/contrib/admin/workflow/workflow.entity.inc
+++ b/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.
diff --git a/sites/all/modules/contrib/admin/workflow/workflow.features.inc b/sites/all/modules/contrib/admin/workflow/workflow.features.inc
index 5867280d..8e850746 100644
--- a/sites/all/modules/contrib/admin/workflow/workflow.features.inc
+++ b/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);
+ }
}
}
}
diff --git a/sites/all/modules/contrib/admin/workflow/workflow.info b/sites/all/modules/contrib/admin/workflow/workflow.info
index 4fb3996b..c39257d2 100644
--- a/sites/all/modules/contrib/admin/workflow/workflow.info
+++ b/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"
diff --git a/sites/all/modules/contrib/admin/workflow/workflow.install b/sites/all/modules/contrib/admin/workflow/workflow.install
index d916636b..748e3d26 100644
--- a/sites/all/modules/contrib/admin/workflow/workflow.install
+++ b/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}');
}
diff --git a/sites/all/modules/contrib/admin/workflow/workflow.module b/sites/all/modules/contrib/admin/workflow/workflow.module
index 7a99e103..07c0b9cb 100644
--- a/sites/all/modules/contrib/admin/workflow/workflow.module
+++ b/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;
}
/**
diff --git a/sites/all/modules/contrib/admin/workflow/workflow.pages.inc b/sites/all/modules/contrib/admin/workflow/workflow.pages.inc
index 1de8c55b..418846b1 100644
--- a/sites/all/modules/contrib/admin/workflow/workflow.pages.inc
+++ b/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) {
diff --git a/sites/all/modules/contrib/admin/workflow/workflow.tokens.inc b/sites/all/modules/contrib/admin/workflow/workflow.tokens.inc
index 72c701ba..80652088 100644
--- a/sites/all/modules/contrib/admin/workflow/workflow.tokens.inc
+++ b/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()) {
diff --git a/sites/all/modules/contrib/admin/workflow/workflow_access/workflow_access.info b/sites/all/modules/contrib/admin/workflow/workflow_access/workflow_access.info
index 2dbf99dc..a7133cfc 100644
--- a/sites/all/modules/contrib/admin/workflow/workflow_access/workflow_access.info
+++ b/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"
diff --git a/sites/all/modules/contrib/admin/workflow/workflow_access/workflow_access.module b/sites/all/modules/contrib/admin/workflow/workflow_access/workflow_access.module
index ebdf8aba..43e721f5 100644
--- a/sites/all/modules/contrib/admin/workflow/workflow_access/workflow_access.module
+++ b/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 alter the priority of
- the Workflow access module.", array('!url' => url('admin/config/workflow/workflow/access'))
+ the Workflow access module.", array('!url' => url(WORKFLOW_ADMIN_UI_PATH . '/access'))
);
if (module_exists('og')) {
@@ -89,30 +117,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().
*
diff --git a/sites/all/modules/contrib/admin/workflow/workflow_access/workflow_access.pages.inc b/sites/all/modules/contrib/admin/workflow/workflow_access/workflow_access.pages.inc
index 65e5af7e..564752b9 100644
--- a/sites/all/modules/contrib/admin/workflow/workflow_access/workflow_access.pages.inc
+++ b/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;
}
diff --git a/sites/all/modules/contrib/admin/workflow/workflow_actions/workflow_actions.info b/sites/all/modules/contrib/admin/workflow/workflow_actions/workflow_actions.info
index afb85179..e8e978e9 100644
--- a/sites/all/modules/contrib/admin/workflow/workflow_actions/workflow_actions.info
+++ b/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.
-
-dependencies[] = workflow
-dependencies[] = trigger
-
package = Workflow
core = 7.x
-; Information added by Drupal.org packaging script on 2017-01-15
-version = "7.x-2.9+10-dev"
+dependencies[] = trigger
+dependencies[] = workflow
+
+configure = admin/structure/trigger/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"
diff --git a/sites/all/modules/contrib/admin/workflow/workflow_actions/workflow_actions.module b/sites/all/modules/contrib/admin/workflow/workflow_actions/workflow_actions.module
index ed5e5390..53545479 100644
--- a/sites/all/modules/contrib/admin/workflow/workflow_actions/workflow_actions.module
+++ b/sites/all/modules/contrib/admin/workflow/workflow_actions/workflow_actions.module
@@ -1,4 +1,5 @@
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;
}
}
diff --git a/sites/all/modules/contrib/admin/workflow/workflow_admin_ui/includes/Entity/EntityWorkflowUIController.php b/sites/all/modules/contrib/admin/workflow/workflow_admin_ui/includes/Entity/EntityWorkflowUIController.php
index 40341220..ebb6b022 100644
--- a/sites/all/modules/contrib/admin/workflow/workflow_admin_ui/includes/Entity/EntityWorkflowUIController.php
+++ b/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':
diff --git a/sites/all/modules/contrib/admin/workflow/workflow_admin_ui/workflow_admin_ui.api.php b/sites/all/modules/contrib/admin/workflow/workflow_admin_ui/workflow_admin_ui.api.php
index 09e76737..39c89cb1 100644
--- a/sites/all/modules/contrib/admin/workflow/workflow_admin_ui/workflow_admin_ui.api.php
+++ b/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();
diff --git a/sites/all/modules/contrib/admin/workflow/workflow_admin_ui/workflow_admin_ui.info b/sites/all/modules/contrib/admin/workflow/workflow_admin_ui/workflow_admin_ui.info
index 7ee1983d..f5830f25 100644
--- a/sites/all/modules/contrib/admin/workflow/workflow_admin_ui/workflow_admin_ui.info
+++ b/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"
diff --git a/sites/all/modules/contrib/admin/workflow/workflow_admin_ui/workflow_admin_ui.module b/sites/all/modules/contrib/admin/workflow/workflow_admin_ui/workflow_admin_ui.module
index 996dad2c..cd853e87 100644
--- a/sites/all/modules/contrib/admin/workflow/workflow_admin_ui/workflow_admin_ui.module
+++ b/sites/all/modules/contrib/admin/workflow/workflow_admin_ui/workflow_admin_ui.module
@@ -19,10 +19,12 @@ define('WORKFLOW_ADMIN_UI_ARROW', '→');
* 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 '
@@ -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'), ''));
$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;
diff --git a/sites/all/modules/contrib/admin/workflow/workflow_admin_ui/workflow_admin_ui.page.labels.inc b/sites/all/modules/contrib/admin/workflow/workflow_admin_ui/workflow_admin_ui.page.labels.inc
index 2aa09237..2d6a43d6 100644
--- a/sites/all/modules/contrib/admin/workflow/workflow_admin_ui/workflow_admin_ui.page.labels.inc
+++ b/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(
diff --git a/sites/all/modules/contrib/admin/workflow/workflow_admin_ui/workflow_admin_ui.page.permissions.inc b/sites/all/modules/contrib/admin/workflow/workflow_admin_ui/workflow_admin_ui.page.permissions.inc
index 184063da..5770c2db 100644
--- a/sites/all/modules/contrib/admin/workflow/workflow_admin_ui/workflow_admin_ui.page.permissions.inc
+++ b/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());
}
}
diff --git a/sites/all/modules/contrib/admin/workflow/workflow_admin_ui/workflow_admin_ui.page.states.inc b/sites/all/modules/contrib/admin/workflow/workflow_admin_ui/workflow_admin_ui.page.states.inc
index 9473c67f..b5b8c10d 100644
--- a/sites/all/modules/contrib/admin/workflow/workflow_admin_ui/workflow_admin_ui.page.states.inc
+++ b/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;
}
/**
diff --git a/sites/all/modules/contrib/admin/workflow/workflow_admin_ui/workflow_admin_ui.page.transitions.inc b/sites/all/modules/contrib/admin/workflow/workflow_admin_ui/workflow_admin_ui.page.transitions.inc
index 34746e12..25aa7a6d 100644
--- a/sites/all/modules/contrib/admin/workflow/workflow_admin_ui/workflow_admin_ui.page.transitions.inc
+++ b/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') . ' ' . 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;
}
diff --git a/sites/all/modules/contrib/admin/workflow/workflow_admin_ui/workflow_admin_ui.page.workflow.inc b/sites/all/modules/contrib/admin/workflow/workflow_admin_ui/workflow_admin_ui.page.workflow.inc
index 1044c21f..d7cb8c3b 100644
--- a/sites/all/modules/contrib/admin/workflow/workflow_admin_ui/workflow_admin_ui.page.workflow.inc
+++ b/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";
}
diff --git a/sites/all/modules/contrib/admin/workflow/workflow_cleanup/workflow_cleanup.info b/sites/all/modules/contrib/admin/workflow/workflow_cleanup/workflow_cleanup.info
index 78a17470..aab4e609 100644
--- a/sites/all/modules/contrib/admin/workflow/workflow_cleanup/workflow_cleanup.info
+++ b/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"
diff --git a/sites/all/modules/contrib/admin/workflow/workflow_cleanup/workflow_cleanup.module b/sites/all/modules/contrib/admin/workflow/workflow_cleanup/workflow_cleanup.module
index 57782a8e..5b040086 100644
--- a/sites/all/modules/contrib/admin/workflow/workflow_cleanup/workflow_cleanup.module
+++ b/sites/all/modules/contrib/admin/workflow/workflow_cleanup/workflow_cleanup.module
@@ -1,4 +1,5 @@
'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
diff --git a/sites/all/modules/contrib/admin/workflow/workflow_cleanup/workflow_cleanup.pages.inc b/sites/all/modules/contrib/admin/workflow/workflow_cleanup/workflow_cleanup.pages.inc
index a1ddac6b..165e1c3c 100644
--- a/sites/all/modules/contrib/admin/workflow/workflow_cleanup/workflow_cleanup.pages.inc
+++ b/sites/all/modules/contrib/admin/workflow/workflow_cleanup/workflow_cleanup.pages.inc
@@ -1,13 +1,13 @@
'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;
+}
diff --git a/sites/all/modules/contrib/admin/workflow/workflow_field/workflowfield.info b/sites/all/modules/contrib/admin/workflow/workflow_field/workflowfield.info
index 97e63263..fbe24ad0 100644
--- a/sites/all/modules/contrib/admin/workflow/workflow_field/workflowfield.info
+++ b/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"
diff --git a/sites/all/modules/contrib/admin/workflow/workflow_field/workflowfield.module b/sites/all/modules/contrib/admin/workflow/workflow_field/workflowfield.module
index 38c014ea..fa631a29 100644
--- a/sites/all/modules/contrib/admin/workflow/workflow_field/workflowfield.module
+++ b/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\'.');
diff --git a/sites/all/modules/contrib/admin/workflow/workflow_node/workflownode.info b/sites/all/modules/contrib/admin/workflow/workflow_node/workflownode.info
index 81b993a7..b4ab32de 100644
--- a/sites/all/modules/contrib/admin/workflow/workflow_node/workflownode.info
+++ b/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"
diff --git a/sites/all/modules/contrib/admin/workflow/workflow_node/workflownode.tokens.inc b/sites/all/modules/contrib/admin/workflow/workflow_node/workflownode.tokens.inc
index ac6cb20c..d99a1d07 100644
--- a/sites/all/modules/contrib/admin/workflow/workflow_node/workflownode.tokens.inc
+++ b/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':
diff --git a/sites/all/modules/contrib/admin/workflow/workflow_notify/workflow_notify.admin.inc b/sites/all/modules/contrib/admin/workflow/workflow_notify/workflow_notify.admin.inc
deleted file mode 100644
index c0383388..00000000
--- a/sites/all/modules/contrib/admin/workflow/workflow_notify/workflow_notify.admin.inc
+++ /dev/null
@@ -1,236 +0,0 @@
- 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,
- '[node:title] 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.'));
-}
diff --git a/sites/all/modules/contrib/admin/workflow/workflow_notify/workflow_notify.info b/sites/all/modules/contrib/admin/workflow/workflow_notify/workflow_notify.info
index 6b9b8639..f0fd7886 100644
--- a/sites/all/modules/contrib/admin/workflow/workflow_notify/workflow_notify.info
+++ b/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
-; 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"
diff --git a/sites/all/modules/contrib/admin/workflow/workflow_notify/workflow_notify.module b/sites/all/modules/contrib/admin/workflow/workflow_notify/workflow_notify.module
index d5fc6be3..cc620997 100644
--- a/sites/all/modules/contrib/admin/workflow/workflow_notify/workflow_notify.module
+++ b/sites/all/modules/contrib/admin/workflow/workflow_notify/workflow_notify.module
@@ -1,9 +1,65 @@
'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().
*/
@@ -21,29 +77,11 @@ 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 '' . t('The selected roles will be notified of each state change selected.') . '
';
}
}
-/**
- * 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().
*/
@@ -51,7 +89,7 @@ function workflow_notify_theme() {
return array(
'workflow_notify_settings_form' => array(
'render element' => 'form',
- 'file' => 'workflow_notify.admin.inc',
+ 'file' => 'workflow_notify.pages.inc',
),
);
}
@@ -66,30 +104,6 @@ function workflow_notify_hook_info() {
return $hooks;
}
-/**
- * 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;
@@ -118,6 +132,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",
'[node:title] 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;
}
diff --git a/sites/all/modules/contrib/admin/workflow/workflow_notify/workflow_notify.pages.inc b/sites/all/modules/contrib/admin/workflow/workflow_notify/workflow_notify.pages.inc
new file mode 100644
index 00000000..e15d5311
--- /dev/null
+++ b/sites/all/modules/contrib/admin/workflow/workflow_notify/workflow_notify.pages.inc
@@ -0,0 +1,230 @@
+ $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,
+ '[node:title] 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.'));
+}
diff --git a/sites/all/modules/contrib/admin/workflow/workflow_notify/workflow_notify_og/workflow_notify_og.info b/sites/all/modules/contrib/admin/workflow/workflow_notify/workflow_notify_og/workflow_notify_og.info
index 3d367f36..b5c6c869 100644
--- a/sites/all/modules/contrib/admin/workflow/workflow_notify/workflow_notify_og/workflow_notify_og.info
+++ b/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"
diff --git a/sites/all/modules/contrib/admin/workflow/workflow_notify/workflow_notify_og/workflow_notify_og.module b/sites/all/modules/contrib/admin/workflow/workflow_notify/workflow_notify_og/workflow_notify_og.module
index c5a581db..c2d409fa 100644
--- a/sites/all/modules/contrib/admin/workflow/workflow_notify/workflow_notify_og/workflow_notify_og.module
+++ b/sites/all/modules/contrib/admin/workflow/workflow_notify/workflow_notify_og/workflow_notify_og.module
@@ -1,4 +1,5 @@
$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";
}
diff --git a/sites/all/modules/contrib/admin/workflow/workflow_revert/workflow_revert.info b/sites/all/modules/contrib/admin/workflow/workflow_revert/workflow_revert.info
index 5cb78a4c..0508ca7e 100644
--- a/sites/all/modules/contrib/admin/workflow/workflow_revert/workflow_revert.info
+++ b/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"
diff --git a/sites/all/modules/contrib/admin/workflow/workflow_revert/workflow_revert.pages.inc b/sites/all/modules/contrib/admin/workflow/workflow_revert/workflow_revert.pages.inc
index 43cd5b90..fa3223cf 100644
--- a/sites/all/modules/contrib/admin/workflow/workflow_revert/workflow_revert.pages.inc
+++ b/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
"));
return $form;
@@ -300,7 +323,7 @@ function image_imagemagick_colorshift(stdClass $image, array $data) {
function coloractions_coloroverlay_form(array $data) {
$defaults = array(
'RGB' => array(
- 'HEX' => '#E2DB6A',
+ 'HEX' => '',
),
);
$data = array_merge($defaults, (array) $data);
@@ -313,7 +336,7 @@ function coloractions_coloroverlay_form(array $data) {
desaturate (greyscale) it before colorizing.
The hue (color wheel) is the direction the
existing colors are shifted. The tone (inner box) is the amount.
- Keep the tone half-way up the left site of the color box
+ Keep the tone half-way up the left side of the color box
for best results.
"));
return $form;
@@ -411,6 +434,126 @@ function image_imagemagick_coloroverlay(stdClass $image, array $data) {
return TRUE;
}
+/**
+ * Image effect form callback for the color multiply effect.
+ *
+ * @param array $data
+ * The current configuration for this image effect.
+ *
+ * @return array
+ * The form definition for this effect.
+ */
+function coloractions_colormultiply_form(array $data) {
+ $defaults = array(
+ 'RGB' => array(
+ 'HEX' => '',
+ ),
+ );
+ $data = array_merge($defaults, (array) $data);
+ $form = array('#theme' => 'imagecache_rgb_form');
+ $form['RGB'] = imagecache_rgb_form($data['RGB']);
+ $form['note'] = array('#value' => t("
+ Note that color multiply is a mathematical filter that doesn't always
+ have the expected result.
+ To shift an image precisely TO a target color,
+ desaturate (greyscale) it before colorizing.
+ The hue (color wheel) is the direction the
+ existing colors are shifted. The tone (inner box) is the amount.
+ Keep the tone half-way up the left side of the color box
+ for best results.
+
"));
+ return $form;
+}
+
+/**
+ * Implements theme_hook() for the color multiply effect summary.
+ *
+ * @param array $variables
+ * An associative array containing:
+ * - data: The current configuration for this image effect.
+ *
+ * @return string
+ * The HTML for the summary of this image effect.
+ * @ingroup themeable
+ */
+function theme_coloractions_colormultiply_summary(array $variables) {
+ return theme_imagecacheactions_rgb($variables['data']);
+}
+
+/**
+ * Image effect callback for the color multiply effect.
+ *
+ * @param stdClass $image
+ * @param array $data
+ *
+ * @return bool
+ * true on success, false otherwise.
+ */
+function coloractions_colormultiply_effect(stdClass $image, array $data) {
+ // Convert color from hex (as it is stored in the UI).
+ if ($data['RGB']['HEX'] && $deduced = imagecache_actions_hex2rgba($data['RGB']['HEX'])) {
+ $data['RGB'] = array_merge($data['RGB'], $deduced);
+ }
+ return image_toolkit_invoke('colormultiply', $image, array($data));
+}
+
+/**
+ * GD toolkit specific implementation of the color multiply effect.
+ *
+ * @param stdClass $image
+ * @param array $data
+ * The parameters for this effect.
+ *
+ * @return bool
+ * true on success, false otherwise.
+ */
+function image_gd_colormultiply(stdClass $image, array $data) {
+ $factor_r = $data['RGB']['red'] / 255;
+ $factor_g = $data['RGB']['green'] / 255;
+ $factor_b = $data['RGB']['blue'] / 255;
+
+ $w = $image->info['width'];
+ $h = $image->info['height'];
+
+ for ($y = 0; $y < $h; $y++) {
+ for ($x = 0; $x < $w; $x++) {
+ $rgb = imagecolorat($image->resource, $x, $y);
+ $source = imagecolorsforindex($image->resource, $rgb);
+
+ $final_r = (int) ($source['red'] * $factor_r);
+ $final_g = (int) ($source['green'] * $factor_g);
+ $final_b = (int) ($source['blue'] * $factor_b);
+
+ $final_colour = imagecolorallocate($image->resource, $final_r, $final_g, $final_b);
+ if ($final_colour === FALSE) {
+ return FALSE;
+ }
+ if (!imagesetpixel($image->resource, $x, $y, $final_colour)) {
+ return FALSE;
+ }
+ }
+ }
+
+ return TRUE;
+}
+
+/**
+ * Imagemagick toolkit specific implementation of the color multiply effect.
+ *
+ * @param stdClass $image
+ * @param array $data
+ * The parameters for this effect.
+ *
+ * @return bool
+ * true on success, false otherwise.
+ */
+function image_imagemagick_colormultiply(stdClass $image, array $data) {
+ $multiply_color = $data['RGB']['HEX'] != '' ? '#' . ltrim($data['RGB']['HEX'], '#') : 'None';
+ $image->ops[] = escapeshellcmd('(') . ' +clone -fill ' . escapeshellarg($multiply_color) . ' -colorize 100 ' . escapeshellcmd(')');
+ $image->ops[] = '-compose multiply -composite';
+ return TRUE;
+}
+
/**
* Image effect form callback for the brightness effect.
@@ -545,16 +688,17 @@ function image_gd_invert(stdClass $image/*, array $data*/) {
/**
* Imagemagick toolkit specific implementation of the image invert effect.
*
- * param stdClass $image
+ * @param stdClass $image
* param array $data
* The parameters for this effect.
*
* @return bool
* true on success, false otherwise.
*/
-function image_imagemagick_invert(/*stdClass $image, array $data*/) {
- // @todo
- return FALSE;
+function image_imagemagick_invert(stdClass $image/*, array $data*/) {
+ // http://www.imagemagick.org/script/command-line-options.php?#negate
+ $image->ops[] = "-negate";
+ return TRUE;
}
@@ -1100,3 +1244,89 @@ function image_gd_desaturatealpha(stdClass $image/*, array $data*/) {
imagealphablending($image->resource, TRUE);
return $result;
}
+
+/**
+ * Image effect form callback for the remove animation effect.
+ *
+ * This effect has no parameters.
+ *
+ * param array $data
+ * The current configuration for this image effect.
+ *
+ * @return array
+ * The form definition for this effect.
+ */
+function coloractions_removeanimation_form(/*array $data*/) {
+ $form = array();
+ $form['help'] = array(
+ '#markup' => "There are no user-configurable options for this effect.
+ This image effect will remove all animation from a gif image, keeping only the first frame. Some notes:
+
+ - GD cannot handle animation at all and will always silently remove animation, whether this effect has been added to an image style or not.
+ - Thus, this effect will only do something with ImageMagick as image toolkit.
+ - Non gif images and non-animated gif images are silently ignored.
+ - You can place this effect anywhere in the list of effects for an image style. There may be some performance gains when you add it as first though.
+
+ ",
+ );
+ return $form;
+}
+
+/**
+ * Implements theme_hook() for the remove animation effect summary.
+ *
+ * param array $variables
+ * An associative array containing:
+ * - data: The current configuration for this image effect.
+ *
+ * @return string
+ * The HTML for the summary of this image effect.
+ * @ingroup themeable
+ */
+function theme_coloractions_removeanimation_summary(/*array $variables*/) {
+ return t('Remove animation, keeping only the first frame.');
+}
+
+/**
+ * Image effect callback for the remove animation effect.
+ *
+ * @param stdClass $image
+ * @param array $data
+ *
+ * @return bool
+ * True on success, false otherwise.
+ */
+function coloractions_removeanimation_effect(stdClass $image, array $data) {
+ return image_toolkit_invoke('removeanimation', $image, array($data));
+}
+
+/**
+ * GD toolkit specific implementation of the remove animation effect.
+ *
+ * param stdClass $image
+ * param array $data
+ * The parameters for this effect.
+ *
+ * @return bool
+ * Always true, GD removes animations anyway.
+ */
+function image_gd_removeanimation(/*stdClass $image, array $data*/) {
+ return TRUE;
+}
+
+/**
+ * Imagemagick toolkit specific implementation of the remove animation effect.
+ *
+ * @param stdClass $image
+ * param array $data
+ * The parameters for this effect.
+ *
+ * @return bool
+ * True on success, false otherwise.
+ */
+function image_imagemagick_removeanimation(stdClass $image/*, array $data*/) {
+ if ($image->info['mime_type'] === 'image/gif') {
+ $image->ops[] = '-delete 1--1';
+ }
+ return TRUE;
+}
diff --git a/sites/all/modules/contrib/files/imagecache_actions/customactions/README.txt b/sites/all/modules/contrib/files/imagecache_actions/customactions/README.txt
index 3d7f9793..814c8585 100644
--- a/sites/all/modules/contrib/files/imagecache_actions/customactions/README.txt
+++ b/sites/all/modules/contrib/files/imagecache_actions/customactions/README.txt
@@ -58,8 +58,9 @@ record so by changing $image->info['width'] and/or $image->info['height'].
General
-------
To ease your task, this effect makes some information regarding the image being
-processed available in 2 variables: $image and $image_context. These variables
-are readily available in your snippet.
+processed available in a number of variables: $image, $image_context,
+$image_style, and $image_effect_id. These variables are readily available in
+your snippet.
$image is an object containing the following properties:
- source: string, the source of the image, e.g. public://photo.jpg
@@ -112,6 +113,18 @@ $image_context is an associative array containing:
- title (string) ...
- ...
+$image_style is an associative array containing the current image style being
+processed. It ocntians a.o.:
+- isid: the unique image style id
+- name: machine name.
+- label: Human readable name.
+- effects: An array with the effects of this image style, ordered in the way
+ they should be applied.
+
+$image_effect_id is an int containng the unique id of the current image effect
+being applied. This can be used to look the current image effect up in the
+$image_style array.
+
Of course there are many other possible useful globals. Think of:
- base_url
- base_path
@@ -143,3 +156,41 @@ foreach ($referring_entities as $field_name => $field_referring_entities) {
}
}
?>
+
+"Dynamic" parameters
+--------------------
+Thee are many requests for adding token support or allowing for dynamic
+parameters in another way. However, the current image style processing does not
+easily allow for this. But for these cases we have the custom action to our
+rescue. It is quite easy to:
+- Create you own array of parameters.
+- Call the effect callback yourself
+
+Exanple, calling the watermark/canvas overlay effect:
+ 'center',
+ 'ypos' => 'center',
+ 'alpha' => '100',
+ 'scale' => '',
+ 'path' => 'module://imagecache_actions/tests/black-ribbon.gif',
+);
+return canvasactions_file2canvas_effect($image, $data);
+?>
+
+Or, to be on the safe side with effect info altering:
+ 'center',
+ 'ypos' => 'center',
+ 'alpha' => '100',
+ 'scale' => '',
+ 'path' => 'module://imagecache_actions/tests/black-ribbon.gif',
+ );
+ return $callback($image, $data);
+}
+return FALSE;
+?>
diff --git a/sites/all/modules/contrib/files/imagecache_actions/customactions/imagecache_customactions.info b/sites/all/modules/contrib/files/imagecache_actions/customactions/imagecache_customactions.info
index 65cb37dd..70740b6f 100644
--- a/sites/all/modules/contrib/files/imagecache_actions/customactions/imagecache_customactions.info
+++ b/sites/all/modules/contrib/files/imagecache_actions/customactions/imagecache_customactions.info
@@ -6,9 +6,8 @@ core = 7.x
dependencies[] = imagecache_actions
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"
diff --git a/sites/all/modules/contrib/files/imagecache_actions/customactions/imagecache_customactions.module b/sites/all/modules/contrib/files/imagecache_actions/customactions/imagecache_customactions.module
index 04ead663..db60579b 100644
--- a/sites/all/modules/contrib/files/imagecache_actions/customactions/imagecache_customactions.module
+++ b/sites/all/modules/contrib/files/imagecache_actions/customactions/imagecache_customactions.module
@@ -156,7 +156,6 @@ function theme_imagecache_customactions_summary(/*array $variables*/) {
* true on success, false otherwise.
*/
function imagecache_customactions_effect(stdClass $image, array $data) {
- // Check that the PHP filter module is enabled.
$result = module_exists('php');
if ($result) {
// Get context about the image.
@@ -164,10 +163,17 @@ function imagecache_customactions_effect(stdClass $image, array $data) {
$GLOBALS['image_context'] = imagecache_actions_get_image_context($image, $data);
$GLOBALS['image'] = $image;
+ // Get (non-alterable) context about the image style and image effect.
+ $execution_info = imagecache_actions_get_image_effect_context();
+ $GLOBALS['image_style'] = $execution_info['image_style'];
+ $GLOBALS['image_effect_id'] = $execution_info['image_effect_id'];
+
$result = php_eval('<' . '?php global $image, $image_context; ' . $data['php'] . ' ?' . '>');
// php_eval returns '1' if the snippet returns true.
$result = $result === '1';
+ unset($GLOBALS['image_effect_id']);
+ unset($GLOBALS['image_style']);
unset($GLOBALS['image']);
unset($GLOBALS['image_context']);
}
diff --git a/sites/all/modules/contrib/files/imagecache_actions/image_effects_text/README.txt b/sites/all/modules/contrib/files/imagecache_actions/image_effects_text/README.txt
index 46bdfe63..a8aa8683 100644
--- a/sites/all/modules/contrib/files/imagecache_actions/image_effects_text/README.txt
+++ b/sites/all/modules/contrib/files/imagecache_actions/image_effects_text/README.txt
@@ -150,8 +150,9 @@ PHP snippets to determine the text
----------------------------------
Given the correct permission, you can write your own PHP snippet to compute the
text to display. To ease this task, this module makes some information regarding
-the image being processed available in 2 variables: $image and $image_context.
-These variables are readily available in your snippet.
+the image being processed available in a number of variables: $image,
+$image_context, $image_style, and $image_effect_id. These variables are readily
+available in your snippet.
$image is an object containing the following properties:
- source: string, the source of the image, e.g. public://photo.jpg
@@ -214,6 +215,18 @@ $image_context is an associative array containing:
- title (string) ...
- ...
+$image_style is an associative array containing the current image style being
+processed. It ocntians a.o.:
+- isid: the unique image style id
+- name: machine name.
+- label: Human readable name.
+- effects: An array with the effects of this image style, ordered in the way
+ they should be applied.
+
+$image_effect_id is an int containng the unique id of the current image effect
+being applied. This can be used to look the current image effect up in the
+$image_style array.
+
Of course there are many other possible useful globals. Think of:
- base_url
- base_path
diff --git a/sites/all/modules/contrib/files/imagecache_actions/image_effects_text/image_effects_text.inc b/sites/all/modules/contrib/files/imagecache_actions/image_effects_text/image_effects_text.inc
index 35e73161..72218f2d 100644
--- a/sites/all/modules/contrib/files/imagecache_actions/image_effects_text/image_effects_text.inc
+++ b/sites/all/modules/contrib/files/imagecache_actions/image_effects_text/image_effects_text.inc
@@ -66,15 +66,6 @@ function image_effects_text_form_inc(array $data) {
// - Change the 'PHP code' textarea.
$allow_php = module_exists('php') && user_access('use PHP for settings');
$defaults = array(
- 'size' => 50,
- 'angle' => 0,
- 'xpos' => '0',
- 'ypos' => '0',
- 'halign' => 'left',
- 'valign' => 'top',
- 'RGB' => array('HEX' => '#000000'),
- 'alpha' => 100,
- 'fontfile' => drupal_get_path('module', 'image_effects_text') . '/Komika_display.ttf',
'text_source' => 'text',
'text' => t('Hello World!'),
'php' => 'if (!$image_context[\'entity\']) {
@@ -88,77 +79,21 @@ if ($field) {
return isset($field[0][\'value\']) ? $field[0][\'value\'] : \'' . t('No field value') . '\';
}
',
+ 'text_case' => 'none',
+ 'fontfile' => drupal_get_path('module', 'image_effects_text') . '/Komika_display.ttf',
+ 'size' => 50,
+ 'RGB' => array('HEX' => '#000000'),
+ 'alpha' => 100,
+ 'xpos' => '0',
+ 'ypos' => '0',
+ 'halign' => 'left',
+ 'valign' => 'top',
+ 'angle' => 0,
);
$data += $defaults;
$tokens = token_info();
$tokens = array_keys($tokens['types']);
$form = array(
- 'size' => array(
- '#type' => 'textfield',
- '#title' => t('Font size'),
- '#default_value' => $data['size'],
- '#description' => t('The font size in points. Only in GD1 this is in pixels.'),
- '#size' => 3,
- ),
- 'xpos' => array(
- '#type' => 'textfield',
- '#title' => t('X offset'),
- '#default_value' => $data['xpos'],
- '#description' => t('Enter an offset in pixels or use a keyword: left, center, or right. Syntax like right-20 is also valid.'),
- '#size' => 10,
- ),
- 'ypos' => array(
- '#type' => 'textfield',
- '#title' => t('Y offset'),
- '#default_value' => $data['ypos'],
- '#description' => t('Enter an offset in pixels or use a keyword: top, center, or bottom. Syntax like bottom-20 is also valid.'),
- '#size' => 10,
- ),
- 'halign' => array(
- '#type' => 'select',
- '#title' => t('Horizontal alignment'),
- '#default_value' => $data['halign'],
- '#description' => t('The horizontal alignment of the text around the given %xpos.', array('%xpos' => t('X offset'))),
- '#options' => array(
- 'left' => t('Left'),
- 'center' => t('Center'),
- 'right' => t('Right')
- ),
- ),
- 'valign' => array(
- '#type' => 'select',
- '#title' => t('Vertical alignment'),
- '#default_value' => $data['valign'],
- '#description' => t('The vertical alignment of the text around the given %ypos.', array('%ypos' => t('Y offset'))),
- '#options' => array(
- 'top' => t('Top'),
- 'center' => t('Center'),
- 'bottom' => t('Bottom')
- ),
- ),
- 'RGB' => imagecache_rgb_form($data['RGB']),
- 'alpha' => array(
- '#type' => 'textfield',
- '#title' => t('Opacity'),
- '#default_value' => $data['alpha'] ? $data['alpha'] : 100,
- '#size' => 3,
- '#description' => t('Opacity: 1-100.'),
- ),
- 'angle' => array(
- '#type' => 'textfield',
- '#title' => t('Angle'),
- '#default_value' => $data['angle'],
- '#description' => t('Angle: The angle in degrees, with 0 degrees being left-to-right reading text. Higher values represent a counter-clockwise rotation. For example, a value of 90 would result in bottom-to-top reading text.'),
- '#size' => 3,
- ),
- 'fontfile' => array(
- '#type' => 'textfield',
- '#title' => t('Font file name'),
- '#default_value' => $data['fontfile'],
- '#description' => imagecache_actions_file_field_description(),
- '#element_validate' => array('image_effects_text_validate_font'),
- '#size' => 80,
- ),
'text_help' => array(
'#type' => 'item',
'#title' => t('Text'),
@@ -221,6 +156,85 @@ if ($field) {
),
'#wysiwyg' => FALSE,
),
+ 'text_case' => array(
+ '#title' => t('Capitalization'),
+ '#type' => 'select',
+ '#options' => array(
+ 'none' => t('No transform'),
+ 'upper' => t('Upper case'),
+ 'lower' => t('Lower case'),
+ 'ucfirst' => t('Capitalize first letter'),
+ 'ucwords' => t('Capitalize each word'),
+ ),
+ '#default_value' => $data['text_case'],
+ '#description' => t('Defines if and how to transform the case of the text to render.'),
+ ),
+ 'fontfile' => array(
+ '#type' => 'textfield',
+ '#title' => t('Font file name'),
+ '#default_value' => $data['fontfile'],
+ '#description' => imagecache_actions_file_field_description(),
+ '#element_validate' => array('image_effects_text_validate_font'),
+ '#size' => 80,
+ ),
+ 'size' => array(
+ '#type' => 'textfield',
+ '#title' => t('Font size'),
+ '#default_value' => $data['size'],
+ '#description' => t('The font size in points. Only in GD1 this is in pixels.'),
+ '#size' => 3,
+ ),
+ 'RGB' => imagecache_rgb_form($data['RGB']),
+ 'alpha' => array(
+ '#type' => 'textfield',
+ '#title' => t('Opacity'),
+ '#default_value' => $data['alpha'],
+ '#size' => 3,
+ '#description' => t('Opacity: 1-100.'),
+ ),
+ 'xpos' => array(
+ '#type' => 'textfield',
+ '#title' => t('X offset'),
+ '#default_value' => $data['xpos'],
+ '#description' => t('Enter an offset in pixels or use a keyword: left, center, or right. Syntax like right-20 is also valid.'),
+ '#size' => 10,
+ ),
+ 'ypos' => array(
+ '#type' => 'textfield',
+ '#title' => t('Y offset'),
+ '#default_value' => $data['ypos'],
+ '#description' => t('Enter an offset in pixels or use a keyword: top, center, or bottom. Syntax like bottom-20 is also valid.'),
+ '#size' => 10,
+ ),
+ 'halign' => array(
+ '#type' => 'select',
+ '#title' => t('Horizontal alignment'),
+ '#default_value' => $data['halign'],
+ '#description' => t('The horizontal alignment of the text around the given %xpos.', array('%xpos' => t('X offset'))),
+ '#options' => array(
+ 'left' => t('Left'),
+ 'center' => t('Center'),
+ 'right' => t('Right')
+ ),
+ ),
+ 'valign' => array(
+ '#type' => 'select',
+ '#title' => t('Vertical alignment'),
+ '#default_value' => $data['valign'],
+ '#description' => t('The vertical alignment of the text around the given %ypos.', array('%ypos' => t('Y offset'))),
+ '#options' => array(
+ 'top' => t('Top'),
+ 'center' => t('Center'),
+ 'bottom' => t('Bottom')
+ ),
+ ),
+ 'angle' => array(
+ '#type' => 'textfield',
+ '#title' => t('Angle'),
+ '#default_value' => $data['angle'],
+ '#description' => t('Angle: The angle in degrees, with 0 degrees being left-to-right reading text. Higher values represent a counter-clockwise rotation. For example, a value of 90 would result in bottom-to-top reading text.'),
+ '#size' => 3,
+ ),
);
if (!$allow_php && $data['text_source'] !== 'php') {
unset($form['text_fieldset']['text_source']['#options']['php']);
@@ -717,12 +731,64 @@ function image_effects_text_get_text(stdClass $image, array $data) {
// variables, so they can be passed successfully.
$GLOBALS['image_context'] = $image_context;
$GLOBALS['image'] = $image;
+
+ // Get (non-alterable) context about the image style and image effect.
+ $execution_info = imagecache_actions_get_image_effect_context();
+ $GLOBALS['image_style'] = $execution_info['image_style'];
+ $GLOBALS['image_effect_id'] = $execution_info['image_effect_id'];
+
// We don't need to check_plain() the resulting text, as the text is not
// rendered in a browser but processed on the server.
$text = module_exists('php') ? php_eval('<' . '?php global $image, $image_context; ' . $data['php'] . ' ?' . '>') : '';
+ unset($GLOBALS['image_effect_id']);
+ unset($GLOBALS['image_style']);
unset($GLOBALS['image']);
unset($GLOBALS['image_context']);
}
+
+ // Convert case.
+ $text = image_effect_text_case_transform($text, isset($data['text_case']) ? $data['text_case'] : 'none');
+
return $text;
}
+
+/**
+ * Transform a string by a certain method.
+ *
+ * Proudly copied from module://views/includes/handlers.inc.
+ *
+ * @param $string
+ * The input you want to transform.
+ * @param $option
+ * How do you want to transform it, possible values:
+ * - upper: Uppercase the string.
+ * - lower: lowercase the string.
+ * - ucfirst: Make the first char uppercase.
+ * - ucwords: Make each word in the string uppercase.
+ *
+ * @return string
+ * The transformed string.
+ */
+function image_effect_text_case_transform($string, $option) {
+ global $multibyte;
+
+ switch ($option) {
+ default:
+ return $string;
+ case 'upper':
+ return drupal_strtoupper($string);
+ case 'lower':
+ return drupal_strtolower($string);
+ case 'ucfirst':
+ return drupal_strtoupper(drupal_substr($string, 0, 1)) . drupal_substr($string, 1);
+ case 'ucwords':
+ if ($multibyte == UNICODE_MULTIBYTE) {
+ return mb_convert_case($string, MB_CASE_TITLE);
+ }
+ else {
+ return ucwords($string);
+ }
+ }
+}
+
diff --git a/sites/all/modules/contrib/files/imagecache_actions/image_effects_text/image_effects_text.info b/sites/all/modules/contrib/files/imagecache_actions/image_effects_text/image_effects_text.info
index 55a92f75..3c417b0d 100644
--- a/sites/all/modules/contrib/files/imagecache_actions/image_effects_text/image_effects_text.info
+++ b/sites/all/modules/contrib/files/imagecache_actions/image_effects_text/image_effects_text.info
@@ -6,9 +6,8 @@ core = 7.x
dependencies[] = image
dependencies[] = imagecache_actions
-; 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"
diff --git a/sites/all/modules/contrib/files/imagecache_actions/image_effects_text/image_effects_text_test/image_effects_text_test.info b/sites/all/modules/contrib/files/imagecache_actions/image_effects_text/image_effects_text_test/image_effects_text_test.info
index 1e117ce0..ca16102d 100644
--- a/sites/all/modules/contrib/files/imagecache_actions/image_effects_text/image_effects_text_test/image_effects_text_test.info
+++ b/sites/all/modules/contrib/files/imagecache_actions/image_effects_text/image_effects_text_test/image_effects_text_test.info
@@ -8,9 +8,8 @@ dependencies[] = image_effects_text
dependencies[] = imagecache_canvasactions
dependencies[] = system_stream_wrapper
-; 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"
diff --git a/sites/all/modules/contrib/files/imagecache_actions/image_styles_admin/README.txt b/sites/all/modules/contrib/files/imagecache_actions/image_styles_admin/README.txt
index 358c3a88..02ee17ff 100644
--- a/sites/all/modules/contrib/files/imagecache_actions/image_styles_admin/README.txt
+++ b/sites/all/modules/contrib/files/imagecache_actions/image_styles_admin/README.txt
@@ -1,5 +1,5 @@
-README for the Image styleds admin Drupal module
-------------------------------------------------
+README for the Image styles admin Drupal module
+-----------------------------------------------
Project page: https://drupal.org/project/imagecache_actions
@@ -14,14 +14,13 @@ Release notes for 7.x-1.x-dev
Introduction
------------
-The Image style admin module extends the administrative interface for image
+The Image styles admin module extends the administrative interface for image
styles by providing additional features.
Currently a duplicate, import and export image style feature are implemented.
More features may be added in the future. These features typically allow you to
-more easily handle image styles. It allows us to more easily set up
-a test/showcase sute of styles. Finally, it allows everybody to test D8 image
-module features in real life.
+more easily handle image styles. It allows us to more easily set up a
+test/showcase suite of styles.
This module is not a replacement for the features module
(https://drupal.org/project/features). If you are serious about configuration
@@ -30,9 +29,3 @@ management and want to distribute styles to other systems, use features.
Use this module for 1 time export/imports between different sites, "copy &
paste" reuse within a site, and when reporting issues to the imagecache_actions
issue queue.
-
-
-TODO
-----
-Solving errors in the core image handling?
-- [#1554074]: scale does not work with imagemagick when dimensions are unknown?
diff --git a/sites/all/modules/contrib/files/imagecache_actions/image_styles_admin/image_styles_admin.inc b/sites/all/modules/contrib/files/imagecache_actions/image_styles_admin/image_styles_admin.inc
index 85188d80..cb066116 100644
--- a/sites/all/modules/contrib/files/imagecache_actions/image_styles_admin/image_styles_admin.inc
+++ b/sites/all/modules/contrib/files/imagecache_actions/image_styles_admin/image_styles_admin.inc
@@ -117,7 +117,7 @@ function image_styles_admin_export_form($form, $form_state, $style) {
'#type' => 'textarea',
'#rows' => 5,
'#title' => t('Image style export data'),
- '#default_value' => image_styles_admin_export_serialize($style),
+ '#default_value' => image_styles_admin_style_to_string($style),
'#attributes' => array('readonly' =>'readonly'),
'#description' => t('Copy the contents of this field to the clipboard and, on another site, paste it in the textarea of an %page_title page.',
array('%page_title' => t('Import image style'))),
@@ -178,16 +178,16 @@ function image_styles_admin_import_form_submit($form, &$form_state) {
}
/**
- * Serializes image style data so it can be exported.
+ * Converts image style data into a json string so it can be exported.
*
* @param array $style
* An image style array.
*
* @return string
- * The serialized image style. Keys that are not needed for import are not
- * serialized.
+ * The image style converted to a string. Keys that are not needed for import
+ * are not serialized.
*/
-function image_styles_admin_export_serialize($style) {
+function image_styles_admin_style_to_string($style) {
$style = array_intersect_key($style, array('name' => 0, 'label' => 0, 'effects' => 0));
foreach ($style['effects'] as &$effect) {
$effect = array_intersect_key($effect, array('weight' => 0, 'name' => 0, 'data' => 0));
@@ -198,16 +198,14 @@ function image_styles_admin_export_serialize($style) {
$value = image_styles_admin_unify_newlines($value);
}
});
- return serialize($style);
+ return json_encode($style);
}
/**
* Unifies newlines in the string to the Unix newline standard.
*
* #2636314: textareas may convert newlines to the underlying OS style: convert
- * all new lines to Unix style before unserializing. As string length is in the
- * serialized data, we must ensure that we also do this on each array value
- * before serializing.
+ * all new lines to Unix style before stringifying an image style.
*
* @param string $str
*
@@ -220,17 +218,41 @@ function image_styles_admin_unify_newlines($str) {
}
/**
- * Unserializes and validates a string into image style data.
+ * Decodes and validates a json string into image style data.
+ *
+ * Some notes on any security implications for creating styles like this:
+ * - json_decode() is considered safe regardless of the contents give to it.
+ * - Not expected array entries are subsequently removed (array_intersect_key)
+ * thus the return will not contain unexpected array entries
+ * - Values with known types are checked.
+ * - Effect data array is not checked as it cannot be checked. Possibly unsafe
+ * but:
+ * - Proper checking and/or converting to int/float/bool while processing an
+ * image derivative is the responsibility of the image effect.
+ * - Effect data is only shown to a user on the edit form and in the image
+ * effect summary theme. Proper escaping and/or converting to int/float/bool
+ * in the theme before rendering it is again the responsibility of the image
+ * effect. On the form it is the form api that will do so.
+ * - Effect data may contain PHP code and if the image effect is allowing this
+ * it may get [php_]eval()'ed. The image effects themselves should check for
+ * the 'use PHP for settings' permission on the create/edit form and check
+ * that the PHP module is enabled on execution (that is: during image
+ * derivative creation).
+ * However, we cannot do so on importing as we cannot know if the imported
+ * image style contains image effects that allow PHP code. Therefore, we use a
+ * separate access right for importing styles that is to be considered having
+ * the same security implications as the 'use PHP for settings' right (from
+ * the PHP module) and thus should only be given to highly trusted users.
*
* @param string $import
- * The string representation of a @see serialize()'d image style array.
+ * The json representation of an image style array.
*
* @return array|false
- * An image style array or false if the string could not be unserialized into
+ * An image style array or false if the string could not be decoded into
* image style data.
*/
function image_styles_admin_import_extract_style($import) {
- $style = unserialize($import);
+ $style = json_decode($import, TRUE);
// Check if the contents of the textarea could be unserialized into an array.
if (!is_array($style)) {
@@ -280,30 +302,5 @@ function image_styles_admin_import_extract_style($import) {
}
}
- // @todo: are there any security implications for creating styles like this?
- // - Unserialize() is save in itself: it only creates data (except possibly
- // for__wakeup(), but that can only be in already existing code: safe
- // - Not expected array entries are removed (array_intersect_key): safe
- // - Basic types are checked: safe
- // - Effect data array is not checked. Possibly unsafe?! The effect data array
- // contains the effect parameters. Normally these are entered and validated
- // via a form and subsequently saved in the database (serialized as here).
- // The form validation is not executed on import and thus the data may
- // contain invalid values. This is acceptable as it can also be done by
- // operating directly on the database. In Drupal this is not normally
- // checked for during processing: error messages will make clear that the
- // data has been played with. Can incorrect data be abused? It may contain:
- // - incorrect types: we do not know the data structure of the various
- // effects, so we cannot check that and have to accept it as it comes.
- // Effects should check_plain in summary theme and convert to int/float
- // whenever possible before using it in commands.
- // - PHP code, but that may be valid content for the text or custom effects:
- // Effects should check_plain in summary theme and convert to int/float
- // whenever possible before using it in commands.
- // @todo: if the style contains an effect that contains PHP code, the user
- // should need the 'use PHP for settings' permission.
- // - HTML and or JS code: when used as parameter, this normally won't hurt.
- // When showing on the screen (summary theme), proper escaping should
- // suffice and is needed anyway: responsibility of effect.
return $style;
}
diff --git a/sites/all/modules/contrib/files/imagecache_actions/image_styles_admin/image_styles_admin.info b/sites/all/modules/contrib/files/imagecache_actions/image_styles_admin/image_styles_admin.info
index 8a995677..01ac4001 100644
--- a/sites/all/modules/contrib/files/imagecache_actions/image_styles_admin/image_styles_admin.info
+++ b/sites/all/modules/contrib/files/imagecache_actions/image_styles_admin/image_styles_admin.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"
diff --git a/sites/all/modules/contrib/files/imagecache_actions/image_styles_admin/image_styles_admin.install b/sites/all/modules/contrib/files/imagecache_actions/image_styles_admin/image_styles_admin.install
new file mode 100644
index 00000000..f8e2ea97
--- /dev/null
+++ b/sites/all/modules/contrib/files/imagecache_actions/image_styles_admin/image_styles_admin.install
@@ -0,0 +1,8 @@
+ array(
+ 'title' => t('Import image styles.') ,
+ 'restrict access' => TRUE,
+ ),
+ );
+}
+
+/**
+ * Determines access to the import image style form for the current user.
+ */
+function image_styles_admin_access() {
+ return user_access('import image styles') && user_access('administer image styles');
+}
+
/**
* Implements hook_menu().
*/
@@ -29,7 +48,7 @@ function image_styles_admin_menu() {
'description' => 'Import an image style.',
'page callback' => 'drupal_get_form',
'page arguments' => array('image_styles_admin_import_form'),
- 'access arguments' => array('administer image styles'),
+ 'access callback' => 'image_styles_admin_access',
'type' => MENU_LOCAL_ACTION,
'weight' => 3,
'file' => 'image_styles_admin.inc',
@@ -41,9 +60,15 @@ function image_styles_admin_menu() {
* Implements hook_preprocess_HOOK for theme image_style_list.
*/
function image_styles_admin_preprocess_image_style_list(&$variables) {
+ // Sort the image styles by name.
+ uasort($variables['styles'], function ($a, $b) {
+ return strcasecmp($a['label'], $b['label']);
+ });
+
// Tell imagecache_actions_preprocess_table to preprocess the next call to
- // theme_table()
+ // theme_table().
$image_styles = array_values($variables['styles']);
+
image_styles_admin_preprocess_table($image_styles);
// Add CSS and JS files.
diff --git a/sites/all/modules/contrib/files/imagecache_actions/imagecache_actions.info b/sites/all/modules/contrib/files/imagecache_actions/imagecache_actions.info
index 2dd92126..d11bbb1d 100644
--- a/sites/all/modules/contrib/files/imagecache_actions/imagecache_actions.info
+++ b/sites/all/modules/contrib/files/imagecache_actions/imagecache_actions.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"
diff --git a/sites/all/modules/contrib/files/imagecache_actions/tests/imagecache_testsuite.info b/sites/all/modules/contrib/files/imagecache_actions/tests/imagecache_testsuite.info
index 04f75715..78df640a 100644
--- a/sites/all/modules/contrib/files/imagecache_actions/tests/imagecache_testsuite.info
+++ b/sites/all/modules/contrib/files/imagecache_actions/tests/imagecache_testsuite.info
@@ -8,9 +8,8 @@ dependencies[] = system_stream_wrapper
features[image][] = 'corners_combo'
-; 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"
diff --git a/sites/all/modules/contrib/files/imagecache_actions/utility-form.inc b/sites/all/modules/contrib/files/imagecache_actions/utility-form.inc
index 296c027b..1d98251f 100644
--- a/sites/all/modules/contrib/files/imagecache_actions/utility-form.inc
+++ b/sites/all/modules/contrib/files/imagecache_actions/utility-form.inc
@@ -19,8 +19,8 @@ function imagecache_actions_pos_form(array $data) {
);
$data = array_merge($defaults, (array) $data);
- $description1 = t('Enter an offset in pixels (e.g. 10, 10px), a percentage (e.g. 25%), or one of the keywords: left, center, or right wih an optional offset (e.g. center, right - 10%).');
- $description2 = t('Enter an offset in pixels (e.g. 10, 10px), a percentage (e.g. 25%), or one of the keywords: top, center, or bottom wih an optional offset (e.g. center, bottom - 10%).');
+ $description1 = t('Enter an offset in pixels (e.g. 10, 10px), a percentage (e.g. 25%), or one of the keywords: left, center, or right with an optional offset (e.g. center, right - 10%).');
+ $description2 = t('Enter an offset in pixels (e.g. 10, 10px), a percentage (e.g. 25%), or one of the keywords: top, center, or bottom with an optional offset (e.g. center, bottom - 10%).');
$form = array(
'xpos' => array(
'#type' => 'textfield',
diff --git a/sites/all/modules/contrib/files/imagecache_actions/utility.inc b/sites/all/modules/contrib/files/imagecache_actions/utility.inc
index f41fc799..c7d58944 100644
--- a/sites/all/modules/contrib/files/imagecache_actions/utility.inc
+++ b/sites/all/modules/contrib/files/imagecache_actions/utility.inc
@@ -143,7 +143,7 @@ function imagecache_actions_get_style_label($style_name) {
}
/**
- * Return an array with context information about the image.
+ * Returns an array with context information about the image.
*
* This information is called by effects that need contextual information or
* that allow custom PHP:
@@ -192,27 +192,33 @@ function imagecache_actions_get_image_context($image, $data) {
+ file_get_file_references($managed_file, NULL, FIELD_LOAD_CURRENT, 'file');
if ($references) {
- // Load referring entities.
+ // Load referring entities., keep track of 1st reference separately.
+ $entity_type_first = '';
+ $field_name_first = '';
foreach ($references as $field_name => $field_references) {
foreach ($field_references as $entity_type => $entity_stubs) {
- $image_context['referring_entities'][$field_name][$entity_type] = entity_load($entity_type, array_keys($entity_stubs));
+ $entities = entity_load($entity_type, array_keys($entity_stubs));
+ if (!empty($entities)) {
+ $image_context['referring_entities'][$field_name][$entity_type] = $entities;
+ // Make it easy to access the '1st' entity and its referring image
+ // field, part 1: entity.
+ if (empty($entity_type_first)) {
+ $entity_type_first = $entity_type;
+ $field_name_first = $field_name;
+ $image_context['entity'] = reset($entities);
+ }
+ }
}
}
- // Make it easy to access the '1st' entity and its referring image field.
- reset($image_context['referring_entities']);
- list($field_name, $field_references) = each($image_context['referring_entities']);
- reset($field_references);
- list($entity_type, $entities) = each($field_references);
- reset($entities);
- list(, $image_context['entity']) = each($entities);
+ // Make it easy to access the '1st' entity and its referring image field,
+ // part 2: image field.
/** @var array|false $image_field */
- $image_field = field_get_items($entity_type, $image_context['entity'], $field_name);
+ $image_field = field_get_items($entity_type_first, $image_context['entity'], $field_name_first);
if ($image_field) {
// Get referring item.
foreach ($image_field as $image_field_value) {
if ($image_field_value['fid'] === $managed_file->fid) {
- // @todo: file_field as well or just ignore the type of field?
$image_context['image_field'] = $image_field_value;
break;
}
@@ -224,6 +230,53 @@ function imagecache_actions_get_image_context($image, $data) {
return $image_context;
}
+
+/**
+ * Returns information about the context, image style and image effect id, of
+ * the current image effect.
+ *
+ * Note that this information is not alterable, that is, it will not have any
+ * effect on the rest of the derivative image generation process including its
+ * subsequent effects.
+ *
+ * This information is called by effects that may need contextual information or
+ * that allow custom PHP:
+ * - Custom action.
+ * - Text from image alt or title.
+ * - Text with tokens.
+ * - Text from PHP code.
+ *
+ * This information is fetched by traversing the backtrace, looking for known
+ * functions that have the image style or effect as argument..
+ *
+ * @return array
+ * Array with keys 'image_style' and 'image_effect_id' pointing to the current
+ * image style (array) resp. image effect id (int).
+ */
+function imagecache_actions_get_image_effect_context() {
+ $result = array();
+ $backtrace = debug_backtrace();
+
+ foreach ($backtrace as $function_call) {
+ if ($function_call['function'] && $function_call['function'] === 'image_effect_apply') {
+ $result['image_effect_id'] = isset($function_call['args'][1]['ieid']) ? $function_call['args'][1]['ieid'] : NULL;
+ }
+ else if ($function_call['function'] && $function_call['function'] === 'image_style_create_derivative') {
+ $result['image_style'] = isset($function_call['args'][0]) ? $function_call['args'][0] : NULL;
+ }
+
+ if (count($result) === 2) {
+ break;
+ }
+ }
+
+ $result += array(
+ 'image_effect_id' => NULL,
+ 'image_style' => NULL,
+ );
+ return $result;
+}
+
/**
* Given two imageapi objects with dimensions, and some positioning values,
* calculate a new x,y for the layer to be placed at.
@@ -369,11 +422,14 @@ function imagecache_actions_calculate_offset($keyword, $value, $base_size, $laye
}
// Handle % values.
- if (substr($value, strlen($value) - 1, 1) == '%') {
- $value = intval($value / 100 * $base_size);
+ if (substr($value, -1) === '%') {
+ // Explicitly convert $value to prevent warnings in PHP 7.1.
+ $value = intval((int) $value / 100 * $base_size);
$offset = -1 * ($layer_size / 2);
}
- $value = $base + ($direction * $value);
+ // $value may contain 'px' at the end: explicitly convert to prevent warnings
+ // in PHP 7.1.
+ $value = $base + ($direction * (int) $value);
// Add any extra offset to position the item.
return $value + $offset;
@@ -389,16 +445,16 @@ function imagecache_actions_calculate_offset($keyword, $value, $base_size, $laye
* A string specifing an RGB color in the formats:
* '#ABC','ABC','#ABCD','ABCD','#AABBCC','AABBCC','#AABBCCDD','AABBCCDD'
*
- * @return array
+ * @return array|false
* An array with four elements for red, green, blue, and alpha.
*/
function imagecache_actions_hex2rgba($hex) {
$hex = ltrim($hex, '#');
if (preg_match('/^[0-9a-f]{3}$/i', $hex)) {
// 'FA3' is the same as 'FFAA33' so r=FF, g=AA, b=33
- $r = str_repeat($hex{0}, 2);
- $g = str_repeat($hex{1}, 2);
- $b = str_repeat($hex{2}, 2);
+ $r = str_repeat($hex[0], 2);
+ $g = str_repeat($hex[1], 2);
+ $b = str_repeat($hex[2], 2);
$a = '0';
}
elseif (preg_match('/^[0-9a-f]{6}$/i', $hex)) {
@@ -412,10 +468,10 @@ function imagecache_actions_hex2rgba($hex) {
}
elseif (preg_match('/^[0-9a-f]{4}$/i', $hex)) {
// 'FA37' is the same as 'FFAA3377' so r=FF, g=AA, b=33, a=77
- $r = str_repeat($hex{0}, 2);
- $g = str_repeat($hex{1}, 2);
- $b = str_repeat($hex{2}, 2);
- $a = str_repeat($hex{3}, 2);
+ $r = str_repeat($hex[0], 2);
+ $g = str_repeat($hex[1], 2);
+ $b = str_repeat($hex[2], 2);
+ $a = str_repeat($hex[3], 2);
}
else {
// error: invalid hex string, @todo: set form error.
@@ -468,12 +524,13 @@ function imagecache_actions_keyword_filter($value, $base_size, $layer_size) {
* Computes a length based on a length specification and an actual length.
*
* Examples:
- * (50, 400) returns 50; (50%, 400) returns 200;
+ * (50, 400) returns 50; (50px, 400) returns 50; (50%, 400) returns 200;
* (50, null) returns 50; (50%, null) returns null;
* (null, null) returns null; (null, 100) returns null.
*
* @param string|null $length_specification
- * The length specification. An integer constant or a % specification.
+ * The length specification. An integer constant optionally followed by 'px'
+ * or '%'.
* @param int|null $current_length
* The current length. May be null.
*
@@ -483,5 +540,9 @@ function imagecache_actions_percent_filter($length_specification, $current_lengt
if (strpos($length_specification, '%') !== FALSE) {
$length_specification = $current_length !== NULL ? str_replace('%', '', $length_specification) * 0.01 * $current_length : NULL;
}
+ else {
+ // Strips 'px' if available.
+ $length_specification = (int) $length_specification;
+ }
return $length_specification;
}
diff --git a/sites/all/modules/contrib/localisation/i18n/README.txt b/sites/all/modules/contrib/localisation/i18n/README.txt
index 5a8a4f14..060563bb 100644
--- a/sites/all/modules/contrib/localisation/i18n/README.txt
+++ b/sites/all/modules/contrib/localisation/i18n/README.txt
@@ -20,7 +20,7 @@ For support, please create a support request for this module's project:
Support questions by email to the module maintainer will be simply ignored. Use the issue tracker.
-Now if you want professional (paid) support the module maintainer may be available occassionally.
+Now if you want professional (paid) support the module maintainer may be available occasionally.
Drop me a message to check availability and hourly rates, http://reyero.net/en/contact
====================================================================
diff --git a/sites/all/modules/contrib/localisation/i18n/i18n.info b/sites/all/modules/contrib/localisation/i18n/i18n.info
index 93db483e..ec7ac182 100644
--- a/sites/all/modules/contrib/localisation/i18n/i18n.info
+++ b/sites/all/modules/contrib/localisation/i18n/i18n.info
@@ -8,9 +8,8 @@ files[] = i18n_object.inc
files[] = i18n.test
configure = admin/config/regional/i18n
-; Information added by Drupal.org packaging script on 2017-01-31
-version = "7.x-1.15"
+; Information added by Drupal.org packaging script on 2020-06-17
+version = "7.x-1.27"
core = "7.x"
project = "i18n"
-datestamp = "1485834792"
-
+datestamp = "1592373390"
diff --git a/sites/all/modules/contrib/localisation/i18n/i18n.module b/sites/all/modules/contrib/localisation/i18n/i18n.module
index b65061dc..4985271f 100644
--- a/sites/all/modules/contrib/localisation/i18n/i18n.module
+++ b/sites/all/modules/contrib/localisation/i18n/i18n.module
@@ -198,7 +198,8 @@ function i18n_language_field_extra() {
*/
function i18n_language_list($field = 'name', $mode = NULL) {
$mode = isset($mode) ? $mode : variable_get('i18n_language_list', I18N_LANGUAGE_ENABLED);
- return locale_language_list($field, I18N_LANGUAGE_EXTENDED & $mode);
+ $all = I18N_LANGUAGE_EXTENDED & $mode;
+ return locale_language_list($field, $all);
}
/**
diff --git a/sites/all/modules/contrib/localisation/i18n/i18n_block/README.txt b/sites/all/modules/contrib/localisation/i18n/i18n_block/README.txt
index 5d0ddb87..a4e80ad9 100644
--- a/sites/all/modules/contrib/localisation/i18n/i18n_block/README.txt
+++ b/sites/all/modules/contrib/localisation/i18n/i18n_block/README.txt
@@ -13,43 +13,56 @@ CONTENTS OF THIS FILE
INTRODUCTION
------------
-The Block languages module, part of the Internationalization (https://www.drupal.org/project/i18n) package, allows the user to configure for which languages each block is visible.
+The Block languages module, part of the Internationalization
+(https://www.drupal.org/project/i18n) package, allows the user to configure
+for which languages each block is visible.
-* For a full description of the module, visit https://www.drupal.org/node/1279698
+* For a full description of the module,
+ visit https://www.drupal.org/node/1279698.
-* To submit bug reports and feature suggestions, or to track changes visit https://www.drupal.org/project/issues/i18n
+* To submit bug reports and feature suggestions, or to track changes visit
+ https://www.drupal.org/project/issues/i18n.
REQUIREMENTS
------------
-This module requires the following modules:
+This module requires the following module:
-Internationalization - https://www.drupal.org/project/i18n
+* Internationalization - https://www.drupal.org/project/i18n
RECOMMENDED MODULES
-------------------
-* Internationalization Views - https://www.drupal.org/project/i18nviews
-* Language Icons - https://www.drupal.org/project/languageicons
-* Translation Overview - https://www.drupal.org/project/translation_overview
-* Localization Client - https://www.drupal.org/project/l10n_client
-* Internationalization contributions - https://www.drupal.org/project/i18n_contrib
+* Internationalization Views - https://www.drupal.org/project/i18nviews
+* Language Icons - https://www.drupal.org/project/languageicons
+* Translation Overview - https://www.drupal.org/project/translation_overview
+* Localization Client - https://www.drupal.org/project/l10n_client
+* Internationalization contributions -
+ https://www.drupal.org/project/i18n_contrib
INSTALLATION
------------
-* This is a submodule of the Internationalization module. Install the Internationalization module as you would normally install a contributed Drupal module. Visit https://www.drupal.org/docs/7/extending-drupal-7/installing-contributed-modules-find-import-enable-configure-drupal-7 for further information.
+This is a submodule of the Internationalization module. Install the
+Internationalization module as you would normally install a contributed Drupal
+module. Visit https://www.drupal.org/node/895232 for further information.
CONFIGURATION
-------------
-The settings for visibility per language are provided under Visibility Settings via the Languages tab when configuring a block.
+The settings for visibility per language are provided under Visibility
+Settings via the Languages tab when configuring a block.
-The Languages tab also provides a setting for whether the block is translatable. For custom blocks, the block title and the block content will be translatable. For blocks defined by modules, only the block title will be translatable. If "Make this block translatable" is selected, a Translate tab will appear for that block. This tab provides a UI for adding translations of the block in each available language.
+The Languages tab also provides a setting for whether the block is translatable.
+For custom blocks, the block title and the block content will be translatable.
+For blocks defined by modules, only the block title will be translatable. If
+"Make this block translatable" is selected, a Translate tab will appear for that
+block. This tab provides a UI for adding translations of the block in each
+available language.
TROUBLESHOOTING
@@ -57,11 +70,16 @@ TROUBLESHOOTING
Conflicts with Context
-The Block languages module conflicts with the Context module, which alters how blocks are rendered. This issue can be tracked in the Internationalization issue queue: http://drupal.org/node/1343044
+The Block languages module conflicts with the Context module, which alters how
+blocks are rendered. This issue can be tracked in the Internationalization
+issue queue: http://drupal.org/node/1343044
String Errors
-The user must allow your used string format to be translated on admin/config/regional/i18n/strings or you are going to have a error message like "The string blocks:block:1:body for textgroup blocks is not allowed for translation because of its text format."
+The user must allow your used string format to be translated on
+admin/config/regional/i18n/strings or you are going to have an error message
+like "The string blocks:block:1:body for textgroup blocks is not allowed for
+translation because of its text format."
MAINTAINERS
diff --git a/sites/all/modules/contrib/localisation/i18n/i18n_block/i18n_block.info b/sites/all/modules/contrib/localisation/i18n/i18n_block/i18n_block.info
index 093f1315..0a32676e 100644
--- a/sites/all/modules/contrib/localisation/i18n/i18n_block/i18n_block.info
+++ b/sites/all/modules/contrib/localisation/i18n/i18n_block/i18n_block.info
@@ -8,9 +8,8 @@ files[] = i18n_block.inc
files[] = i18n_block.test
-; Information added by Drupal.org packaging script on 2017-01-31
-version = "7.x-1.15"
+; Information added by Drupal.org packaging script on 2020-06-17
+version = "7.x-1.27"
core = "7.x"
project = "i18n"
-datestamp = "1485834792"
-
+datestamp = "1592373390"
diff --git a/sites/all/modules/contrib/localisation/i18n/i18n_block/i18n_block.module b/sites/all/modules/contrib/localisation/i18n/i18n_block/i18n_block.module
index 5328a5fc..6c8c79bb 100644
--- a/sites/all/modules/contrib/localisation/i18n/i18n_block/i18n_block.module
+++ b/sites/all/modules/contrib/localisation/i18n/i18n_block/i18n_block.module
@@ -37,6 +37,17 @@ function i18n_block_menu() {
return $items;
}
+/**
+ * Implements hook_permission().
+ */
+function i18n_block_permission() {
+ return array(
+ 'translate blocks' => array(
+ 'title' => t('Translate Blocks'),
+ ),
+ );
+}
+
/**
* Implement hook_menu_alter().
*
@@ -59,7 +70,7 @@ function i18n_block_menu_alter(&$items) {
*/
function i18n_block_translate_tab_access($module, $delta) {
$block = block_load($module, $delta);
- return user_access('translate interface') && $block && isset($block->i18n_mode) && ($block->i18n_mode == I18N_MODE_LOCALIZE);
+ return (user_access('translate interface') || user_access('translate blocks')) && $block && isset($block->i18n_mode) && ($block->i18n_mode == I18N_MODE_LOCALIZE);
}
/**
@@ -226,7 +237,7 @@ function i18n_block_form_block_admin_configure_alter(&$form, &$form_state, $form
'#options' => i18n_language_list(),
'#description' => t('If no language is selected, block will show regardless of language.'),
);
- if (user_access('translate interface')) {
+ if (user_access('translate interface') || user_access('translate blocks')) {
$form['actions']['translate'] = array(
'#type' => 'submit',
'#name' => 'save_translate',
diff --git a/sites/all/modules/contrib/localisation/i18n/i18n_block/i18n_block.test b/sites/all/modules/contrib/localisation/i18n/i18n_block/i18n_block.test
index b1e46809..e33d99ef 100644
--- a/sites/all/modules/contrib/localisation/i18n/i18n_block/i18n_block.test
+++ b/sites/all/modules/contrib/localisation/i18n/i18n_block/i18n_block.test
@@ -72,15 +72,16 @@ class i18nBlocksTestCase extends Drupali18nTestCase {
$this->clickLink(t('translate'));
+ // Title is a textarea, body is a text_format.
$this->assertFieldByName('strings[blocks:block:' . $box2['delta'] . ':title]', $translations['title']['es']);
- $this->assertFieldByName('strings[blocks:block:' . $box2['delta'] . ':body]', $translations['body']['es']);
+ $this->assertFieldByName('strings[blocks:block:' . $box2['delta'] . ':body][value]', $translations['body']['es']);
// Update the translation.
$translations['title']['es'] = $this->randomName(10);
$translations['body']['es'] = $this->randomName(20);
$edit = array(
'strings[blocks:block:' . $box2['delta'] . ':title]' => $translations['title']['es'],
- 'strings[blocks:block:' . $box2['delta'] . ':body]' => $translations['body']['es'],
+ 'strings[blocks:block:' . $box2['delta'] . ':body][value]' => $translations['body']['es'],
);
$this->drupalPost(NULL, $edit, t('Save translation'));
$this->i18nAssertTranslations($translations['title'], '', 'Updated block title translation displayed.');
diff --git a/sites/all/modules/contrib/localisation/i18n/i18n_contact/README.txt b/sites/all/modules/contrib/localisation/i18n/i18n_contact/README.txt
index cc62ab7f..73d94a3f 100644
--- a/sites/all/modules/contrib/localisation/i18n/i18n_contact/README.txt
+++ b/sites/all/modules/contrib/localisation/i18n/i18n_contact/README.txt
@@ -12,47 +12,56 @@ CONTENTS OF THIS FILE
INTRODUCTION
------------
-The Contact translation module, part of the Internationalization (https://www.drupal.org/project/i18n) package, helps with the multilingual configuration of the site contact forms. This module makes contact categories and replies available for translation.
+The Contact translation module, part of the Internationalization
+(https://www.drupal.org/project/i18n) package, helps with the multilingual
+configuration of the site contact forms. This module makes contact categories
+and replies available for translation.
-* For a full description of the module, visit https://www.drupal.org/node/1396984
+* For a full description of the module, visit
+ https://www.drupal.org/node/1396984.
-* To submit bug reports and feature suggestions, or to track changes, visit https://www.drupal.org/project/issues/i18n
+* To submit bug reports and feature suggestions, or to track changes,
+ visit https://www.drupal.org/project/issues/i18n.
REQUIREMENTS
------------
-This module requires the following modules:
+This module requires the following module:
-Internationalization (https://www.drupal.org/project/i18n)
+* Internationalization - https://www.drupal.org/project/i18n
RECOMMENDED MODULES
-------------------
-* Internationalization Views (https://www.drupal.org/project/i18nviews)
-* Language Icons (https://www.drupal.org/project/languageicons)
-* Translation Overview (https://www.drupal.org/project/translation_overview)
-* Localization Client (https://www.drupal.org/project/l10n_client)
-* Internationalization contributions (https://www.drupal.org/project/i18n_contrib)
+* Internationalization Views - https://www.drupal.org/project/i18nviews
+* Language Icons - https://www.drupal.org/project/languageicons
+* Translation Overview - https://www.drupal.org/project/translation_overview
+* Localization Client - https://www.drupal.org/project/l10n_client
+* Internationalization contributions -
+ https://www.drupal.org/project/i18n_contrib
INSTALLATION
------------
-* This is a submodule of the Internationalization module. Install the Internationalization module as you would normally install a contributed Drupal module. See https://drupal.org/documentation/install/modules-themes/modules-7 for further information.
+This is a submodule of the Internationalization module. Install the
+Internationalization module as you would normally install a contributed Drupal
+module. Visit https://www.drupal.org/node/895232 for further information.
CONFIGURATION
-------------
-1. Enable the Contact translation module included with the Internationalization module.
+1. Enable the Contact translation module included with the Internationalization
+ module.
2. Go to Administration > Structure > Contact form.
-3. Click edit for the form to configure.
-4. Click the Translate tab.
-5. Click the translate link for a language.
+3. Select edit for the form to configure.
+4. Select the Translate tab.
+5. Select the translate link for a language.
6. Translate the Category and Auto-reply text.
-7. Click Save translation.
+7. Select Save translation.
8. Repeat steps 5 to 7 for each language.
9. Repeat steps 2 to 8 for all forms.
diff --git a/sites/all/modules/contrib/localisation/i18n/i18n_contact/i18n_contact.info b/sites/all/modules/contrib/localisation/i18n/i18n_contact/i18n_contact.info
index a0946833..e1084bdf 100644
--- a/sites/all/modules/contrib/localisation/i18n/i18n_contact/i18n_contact.info
+++ b/sites/all/modules/contrib/localisation/i18n/i18n_contact/i18n_contact.info
@@ -5,9 +5,8 @@ dependencies[] = i18n_string
package = Multilingual - Internationalization
core = 7.x
-; Information added by Drupal.org packaging script on 2017-01-31
-version = "7.x-1.15"
+; Information added by Drupal.org packaging script on 2020-06-17
+version = "7.x-1.27"
core = "7.x"
project = "i18n"
-datestamp = "1485834792"
-
+datestamp = "1592373390"
diff --git a/sites/all/modules/contrib/localisation/i18n/i18n_field/README.txt b/sites/all/modules/contrib/localisation/i18n/i18n_field/README.txt
index cb7a5e5e..04d038ef 100644
--- a/sites/all/modules/contrib/localisation/i18n/i18n_field/README.txt
+++ b/sites/all/modules/contrib/localisation/i18n/i18n_field/README.txt
@@ -12,47 +12,60 @@ CONTENTS OF THIS FILE
INTRODUCTION
------------
-The Field translation module, part of the Internationalization (https://www.drupal.org/project/i18n) package, allows for translation of text associated with a field's settings including the label, help text, default value, and list options.
+The Field translation module, part of the Internationalization
+(https://www.drupal.org/project/i18n) package, allows for translation of text
+associated with a field's settings including the label, help text, default
+value, and list options.
-* For a full description of the module, visit this page https://www.drupal.org/node/1279346
+* For a full description of the module, visit this page
+ https://www.drupal.org/node/1279346.
-* To submit bug reports and feature suggestions, or to track changes visit https://www.drupal.org/project/issues/i18n
+* To submit bug reports and feature suggestions, or to track changes visit
+ https://www.drupal.org/project/issues/i18n.
REQUIREMENTS
------------
-This module requires the following modules:
+This module requires the following module:
-Internationalization (https://www.drupal.org/project/i18n)
+* Internationalization - https://www.drupal.org/project/i18n
RECOMMENDED MODULES
-------------------
-* Internationalization Views (https://www.drupal.org/project/i18nviews)
-* Language Icons (https://www.drupal.org/project/languageicons)
-* Translation Overview (https://www.drupal.org/project/translation_overview)
-* Localization Client (https://www.drupal.org/project/l10n_client)
-* Internationalization contributions (https://www.drupal.org/project/i18n_contrib)
+* Internationalization Views - https://www.drupal.org/project/i18nviews
+* Language Icons - https://www.drupal.org/project/languageicons
+* Translation Overview - https://www.drupal.org/project/translation_overview
+* Localization Client - https://www.drupal.org/project/l10n_client
+* Internationalization contributions -
+ https://www.drupal.org/project/i18n_contrib
INSTALLATION
------------
-* This is a submodule of the Internationalization module. Install the Internationalization module as you would normally install a contributed Drupal module. Visit https://drupal.org/documentation/install/modules-themes/modules-7 for further information.
+This is a submodule of the Internationalization module. Install the
+Internationalization module as you would normally install a contributed Drupal
+module. Visit https://www.drupal.org/node/895232 for further information.
CONFIGURATION
-------------
1. Enable the Field translation module included with Internationalization.
-2. Go to Administration > Configuration > Regional and language > Translate interface.
-3. Click on Filter Translatable Strings field set and limit search to fields.
+2. Go to Administration > Configuration > Regional and language > Translate
+ interface.
+3. Select the Filter Translatable Strings field set and limit search to fields.
4. Edit the desired field and Save.
-For the translation to be displayed, you need to use some of the Field Formatters provided by this module whose name usually ends up in 'translated'. For most core fields it is Default translated.
-Note: The Field Translation module does not provide content translation for fields. This functionality is provided by the Entity Translation (ET) module.
+For the translation to be displayed, the user needs to use some of the Field
+Formatters provided by this module whose name usually ends up in 'translated'.
+For most core fields it is Default translated.
+
+Note: The Field Translation module does not provide content translation for
+fields. This functionality is provided by the Entity Translation (ET) module.
MAINTAINERS
diff --git a/sites/all/modules/contrib/localisation/i18n/i18n_field/i18n_field.i18n.inc b/sites/all/modules/contrib/localisation/i18n/i18n_field/i18n_field.i18n.inc
index 1e31c483..c1e6e9c4 100644
--- a/sites/all/modules/contrib/localisation/i18n/i18n_field/i18n_field.i18n.inc
+++ b/sites/all/modules/contrib/localisation/i18n/i18n_field/i18n_field.i18n.inc
@@ -72,7 +72,7 @@ function i18n_field_i18n_string_info() {
'description' => t('Configurable fields descriptions, defaults, options, etc.'),
'format' => FALSE, // This group doesn't have formatted strings
'list' => TRUE, // This group can list all strings
- 'class' => 'i18n_string_textgroup_cached',
+ 'class' => variable_get('i18n_string_textgroup_class_field', 'i18n_string_textgroup_cached'),
);
return $groups;
}
diff --git a/sites/all/modules/contrib/localisation/i18n/i18n_field/i18n_field.info b/sites/all/modules/contrib/localisation/i18n/i18n_field/i18n_field.info
index e9c20f06..2c126d89 100644
--- a/sites/all/modules/contrib/localisation/i18n/i18n_field/i18n_field.info
+++ b/sites/all/modules/contrib/localisation/i18n/i18n_field/i18n_field.info
@@ -6,9 +6,8 @@ package = Multilingual - Internationalization
core = 7.x
files[] = i18n_field.inc
files[] = i18n_field.test
-; Information added by Drupal.org packaging script on 2017-01-31
-version = "7.x-1.15"
+; Information added by Drupal.org packaging script on 2020-06-17
+version = "7.x-1.27"
core = "7.x"
project = "i18n"
-datestamp = "1485834792"
-
+datestamp = "1592373390"
diff --git a/sites/all/modules/contrib/localisation/i18n/i18n_field/i18n_field.module b/sites/all/modules/contrib/localisation/i18n/i18n_field/i18n_field.module
index f78f9c0e..6f97006b 100644
--- a/sites/all/modules/contrib/localisation/i18n/i18n_field/i18n_field.module
+++ b/sites/all/modules/contrib/localisation/i18n/i18n_field/i18n_field.module
@@ -194,6 +194,9 @@ function i18n_field_field_widget_form_alter(&$element, &$form_state, $context) {
// Single-value file fields and image fields.
$alter_element = &$element[0];
}
+ elseif ($field['type'] == 'url' && $field['module'] == 'url' && $field['cardinality'] == 1) {
+ $alter_element = &$element;
+ }
elseif (isset($element['value'])) {
// Number fields. Single-value text fields.
$alter_element = &$element['value'];
@@ -202,6 +205,10 @@ function i18n_field_field_widget_form_alter(&$element, &$form_state, $context) {
// Entityreference fields using the entityreference_autocomplete widget.
$alter_element = &$element['target_id'];
}
+ elseif ($field['type'] == 'node_reference' && isset($element['nid'])) {
+ // The node_reference fields using the entityreference_autocomplete widget.
+ $alter_element = &$element['nid'];
+ }
else {
// All other fields.
$alter_element = &$element;
@@ -456,6 +463,27 @@ function i18n_field_field_info_alter(&$field_info) {
}
}
+/**
+ * Prime the cache to avoid single db queries for entity fields / properties.
+ *
+ * This is mainly uses when large operations are occuring like a flush of the
+ * entity_property_infos().
+ */
+function i18n_field_prime_caches() {
+ global $language;
+ static $cache_primed;
+
+ // Fill the cache. This should avoid single db queries when filling the
+ // properties.
+ if (empty($cache_primed)) {
+ $cache_primed = TRUE;
+ $text_group = i18n_string_textgroup('field');
+ // Load all strings at once to avoid callbacks for each individual string.
+ $text_group->load_strings();
+ $text_group->multiple_translation_search(array('type' => '*', 'objectid' => '*', 'property' => '*'), $language->language);
+ }
+}
+
/**
* Callback to translate entity property info for a fields.
*
@@ -478,6 +506,7 @@ function i18n_field_entity_property_callback(&$info, $entity_type, $field, $inst
return;
}
+ i18n_field_prime_caches();
$name = $field['field_name'];
$property = &$info[$entity_type]['bundles'][$instance['bundle']]['properties'][$name];
$property['label'] = i18n_field_translate_property($instance, 'label', $language->language);
@@ -491,9 +520,38 @@ function i18n_field_i18n_object_info_alter(&$info) {
if ($info = drupal_static('i18n_object_info')) {
// Clean static and permanent cache of the data and then re-run the property
// building.
- drupal_static_reset('entity_get_property_info');
- cache_clear_all('entity_property_info:' . $GLOBALS['language']->language, 'cache');
- entity_get_property_info();
+ // Use a lock to avoid stampeding.
+ $lock_name = 'i18n_field_entity_property_callback_fallback:' . $GLOBALS['language']->language;
+ // See if another request is already doing this. If so we bail out here as
+ // we won't help with anything at the moment.
+ if (!lock_may_be_available($lock_name)) {
+ return;
+ }
+ if (lock_acquire($lock_name)) {
+ i18n_field_prime_caches();
+ // Inject translated properties.
+ $entity_property_info = entity_get_property_info();
+ foreach ($entity_property_info as $entity_type => $properties) {
+ if (isset($properties['bundles'])) {
+ foreach ($properties['bundles'] as $bundle => $bundle_properties) {
+ if ($bundle_properties['properties']) {
+ foreach ($bundle_properties['properties'] as $bundle_property => $bundle_property_info) {
+ if ($instance = field_info_instance($entity_type, $bundle_property, $bundle)) {
+ $property = &$entity_property_info[$entity_type]['bundles'][$instance['bundle']]['properties'][$bundle_property];
+ $property['label'] = i18n_field_translate_property($instance, 'label', $GLOBALS['language']->language);
+ }
+ }
+ }
+ }
+ }
+ }
+ // Inject into static cache.
+ $entity_get_property_info = &drupal_static('entity_get_property_info', array());
+ $entity_get_property_info = $entity_property_info;
+ // Write permanent cache.
+ cache_set('entity_property_info:' . $GLOBALS['language']->language, $entity_property_info);
+ lock_release($lock_name);
+ }
}
else {
watchdog('i18n_field', 'Unable to run fall-back handling for entity property translation due missing "i18n_object_info" cache', array(), WATCHDOG_WARNING);
@@ -511,4 +569,4 @@ function i18n_field_module_implements_alter(&$implementations, $hook) {
unset($implementations['i18n_field']);
$implementations['i18n_field'] = $group;
}
-}
\ No newline at end of file
+}
diff --git a/sites/all/modules/contrib/localisation/i18n/i18n_forum/README.txt b/sites/all/modules/contrib/localisation/i18n/i18n_forum/README.txt
index e8ab6bf4..8b0a0cdf 100644
--- a/sites/all/modules/contrib/localisation/i18n/i18n_forum/README.txt
+++ b/sites/all/modules/contrib/localisation/i18n/i18n_forum/README.txt
@@ -12,35 +12,41 @@ CONTENTS OF THIS FILE
INTRODUCTION
------------
-The Multilingual forum module, part of the Internationalization (https://www.drupal.org/project/i18n) package, helps with the multilingual configuration of the site’s forums.
+The Multilingual forum module, part of the Internationalization
+(https://www.drupal.org/project/i18n) package, helps with the multilingual
+configuration of the site’s forums.
-* For a full description of the module visit https://www.drupal.org/node/1396988
+* For a full description of the module visit
+ https://www.drupal.org/node/1396988.
-* To submit bug reports and feature suggestions, or to track changes visit https://www.drupal.org/project/issues/i18n
+* To submit bug reports and feature suggestions, or to track changes visit
+ https://www.drupal.org/project/issues/i18n.
REQUIREMENTS
------------
-This module requires the following modules:
+This module requires the following module:
-* Internationalization (https://www.drupal.org/project/i18n)
+* Internationalization - https://www.drupal.org/project/i18n
RECOMMENDED MODULES
-------------------
-* Internationalization Views (https://www.drupal.org/project/i18nviews)
-* Language Icons (https://www.drupal.org/project/languageicons)
-* Translation Overview (https://www.drupal.org/project/translation_overview)
-* Localization Client (https://www.drupal.org/project/l10n_client)
-* Internationalization contributions (https://www.drupal.org/project/i18n_contrib)
+* Internationalization Views - https://www.drupal.org/project/i18nviews
+* Language Icons - https://www.drupal.org/project/languageicons
+* Translation Overview - https://www.drupal.org/project/translation_overview
+* Localization Client - https://www.drupal.org/project/l10n_client
+* Internationalization contributions -
+ https://www.drupal.org/project/i18n_contrib
INSTALLATION
-
------------
-* This is a submodule of the Internationalization module. Install the Internationalization module as you would normally install a contributed Drupal module. See https://www.drupal.org/docs/7/extending-drupal-7/installing-contributed-modules-find-import-enable-configure-drupal-7 for further information.
+This is a submodule of the Internationalization module. Install the
+Internationalization module as you would normally install a contributed Drupal
+module. Visit https://www.drupal.org/node/895232 for further information.
CONFIGURATION
@@ -50,22 +56,22 @@ To configure forum vocabulary
1. Enable the Multilingual forum module included with Internationalization.
2. Go to Administration > Structure > Taxonomy.
-3. Click "edit vocabulary" for the Forums vocabulary.
+3. Select the "edit vocabulary" for the Forums vocabulary.
4. Choose the translation mode (Localize or Translate).
-5. Click "Save and translate" button.
-6. Click "translate" link for a language.
+5. Select the "Save and translate" button.
+6. Select the "translate" link for a language.
7. Translate the "Name" and "Description" for the forum.
-8. Click "Save translation" button.
+8. Select the "Save translation" button.
9. Repeat steps 6 to 8 for each language.
To configure forum terms
1. Go to Administration > Structure > Forums.
-2. Click "edit" link for a forum or container.
-3. Click "Translate" tab.
-4. Click "translate" link for a language.
+2. Select the "edit" link for a forum or container.
+3. Select the "Translate" tab.
+4. Select the "translate" link for a language.
5. Translate the "Name" and "Description" for the term.
-6. Click "Save translation" button.
+6. Select the "Save translation" button.
7. Repeat steps 4 to 6 for each language.
8. Repeat all steps for all terms.
diff --git a/sites/all/modules/contrib/localisation/i18n/i18n_forum/i18n_forum.info b/sites/all/modules/contrib/localisation/i18n/i18n_forum/i18n_forum.info
index 32548a50..249fb66a 100644
--- a/sites/all/modules/contrib/localisation/i18n/i18n_forum/i18n_forum.info
+++ b/sites/all/modules/contrib/localisation/i18n/i18n_forum/i18n_forum.info
@@ -7,9 +7,8 @@ package = Multilingual - Internationalization
core = 7.x
files[] = i18n_forum.test
-; Information added by Drupal.org packaging script on 2017-01-31
-version = "7.x-1.15"
+; Information added by Drupal.org packaging script on 2020-06-17
+version = "7.x-1.27"
core = "7.x"
project = "i18n"
-datestamp = "1485834792"
-
+datestamp = "1592373390"
diff --git a/sites/all/modules/contrib/localisation/i18n/i18n_menu/README.txt b/sites/all/modules/contrib/localisation/i18n/i18n_menu/README.txt
index 76eef55e..4f5c935b 100644
--- a/sites/all/modules/contrib/localisation/i18n/i18n_menu/README.txt
+++ b/sites/all/modules/contrib/localisation/i18n/i18n_menu/README.txt
@@ -13,62 +13,80 @@ CONTENTS OF THIS FILE
INTRODUCTION
------------
-The Menu translation module, part of the Internationalization (https://www.drupal.org/project/i18n) package, allows users to select a translation mode for each menu.
+The Menu translation module, part of the Internationalization
+(https://www.drupal.org/project/i18n) package, allows users to select a
+translation mode for each menu.
* For a full description of the module, visit this page:
-https://www.drupal.org/node/1113982
+ https://www.drupal.org/node/1113982.
* To submit bug reports and feature suggestions, or to track changes:
-https://www.drupal.org/project/issues/i18n
+ https://www.drupal.org/project/issues/i18n.
REQUIREMENTS
------------
-This module requires the following modules:
+This module requires the following module:
-* Internationalization (https://www.drupal.org/project/i18n)
+* Internationalization - https://www.drupal.org/project/i18n
RECOMMENDED MODULES
-------------------
-* Internationalization Views (https://www.drupal.org/project/i18nviews)
-* Language Icons (https://www.drupal.org/project/languageicons)
-* Translation Overview (https://www.drupal.org/project/translation_overview)
-* Localization Client (https://www.drupal.org/project/l10n_client)
-* Internationalization contributions (https://www.drupal.org/project/i18n_contrib)
+* Internationalization Views - https://www.drupal.org/project/i18nviews
+* Language Icons - https://www.drupal.org/project/languageicons
+* Translation Overview - https://www.drupal.org/project/translation_overview
+* Localization Client - https://www.drupal.org/project/l10n_client
+* Internationalization contributions -
+ https://www.drupal.org/project/i18n_contrib
To link menu item menus to nodes, it is useful to have the following modules:
-* Entity translation i18n menu module, a sub module of Entity translation (https://www.drupal.org/project/entity_translation)
-* Menu translation node module (https://www.drupal.org/project/i18n_menu_node)
+* Entity translation i18n menu module, a submodule of Entity translation -
+ https://www.drupal.org/project/entity_translation
+* Menu translation node module - https://www.drupal.org/project/i18n_menu_node
INSTALLATION
------------
-* This is a submodule of the Internationalization module. Install the Internationalization module as you would normally install a contributed Drupal module. Visit https://www.drupal.org/docs/7/extending-drupal-7/installing-contributed-modules-find-import-enable-configure-drupal-7 for further information
+This is a submodule of the Internationalization module. Install the
+Internationalization module as you would normally install a contributed Drupal
+module. Visit https://www.drupal.org/node/895232 for further information.
CONFIGURATION
-------------
Language-specific menus
-1. To create or edit a menu, navigate to Structure > Menus > (menu to edit) > Edit.
-2. In the Translation mode section, choose Fixed Language and a Language field will appear.
+1. To create or edit a menu, navigate to Structure > Menus > (menu to edit) >
+ Edit.
+2. In the Translation mode section, choose Fixed Language and a Language field
+ will appear.
3. Select a language, select Save, and add or update the menu items as needed.
The menu block will only appear when viewing content in the same language.
-There are three modes available:
+There are three modes available: Translate and Localize, Fixed Language, and No
+Multilingual Options.
Translate and Localize:
-You can create one menu for all languages, and translate or localize each menu item. There are two ways that menu items will be translated.
-1. You can set a language when creating a custom menu item so that the menu item will only show up for that language. Menu items that link to nodes in a particular language will be treated this way.
-2. You can localize other custom menu items without a language (for example, menu items linking to Views pages). Use the Translate tab to translate the menu item title and description. Translators can also use the "Translate interface" pages to translate these menu items.
+The user can create one menu for all languages, and translate or localize each
+menu item. There are two ways that menu items will be translated.
+1. The user can set a language when creating a custom menu item so that the menu
+ item will only show up for that language. Menu items that link to nodes in a
+ particular language will be treated this way.
+2. The user can localize other custom menu items without a language
+ (for example, menu items linking to Views pages). Use the Translate tab to
+ translate the menu item title and description. Translators can also use the
+ "Translate interface" pages to translate these menu items.
Fixed Language:
-If you choose Fixed Language, you'll have to set up a separate menu in each language. This could become tedious if have a lot of languages enabled on your site, but is useful if the content or menu structure is different for each language.
+If the user chooses Fixed Language, they'll have to set up a separate menu in
+each language. This could become tedious if have a lot of languages enabled on
+the site, but is useful if the content or menu structure is different for each
+language.
No Multilingual Options:
Only the menu will be translatable.
@@ -76,7 +94,11 @@ Only the menu will be translatable.
TROUBLESHOOTING
---------------
-A menu item linked to a node will be displayed only when the node language matches the page language. This is due to how the menu system works and the "Language selection" feature in i18n. Therefore, to get translated menus items that link to nodes, you first need translated content. For more information visit https://www.drupal.org/docs/7/multilingual/translating-content.
+A menu item linked to a node will be displayed only when the node language
+matches the page language. This is due to how the menu system works and the
+"Language selection" feature in i18n. Therefore, to get translated menus items
+that link to nodes, you first need translated content. For more information
+visit https://www.drupal.org/docs/7/multilingual/translating-content.
MAINTAINERS
diff --git a/sites/all/modules/contrib/localisation/i18n/i18n_menu/i18n_menu.info b/sites/all/modules/contrib/localisation/i18n/i18n_menu/i18n_menu.info
index c4fe9f97..5b210b9c 100644
--- a/sites/all/modules/contrib/localisation/i18n/i18n_menu/i18n_menu.info
+++ b/sites/all/modules/contrib/localisation/i18n/i18n_menu/i18n_menu.info
@@ -10,9 +10,8 @@ core = 7.x
files[] = i18n_menu.inc
files[] = i18n_menu.test
-; Information added by Drupal.org packaging script on 2017-01-31
-version = "7.x-1.15"
+; Information added by Drupal.org packaging script on 2020-06-17
+version = "7.x-1.27"
core = "7.x"
project = "i18n"
-datestamp = "1485834792"
-
+datestamp = "1592373390"
diff --git a/sites/all/modules/contrib/localisation/i18n/i18n_menu/i18n_menu.module b/sites/all/modules/contrib/localisation/i18n/i18n_menu/i18n_menu.module
index 9a05ba74..46ce7388 100644
--- a/sites/all/modules/contrib/localisation/i18n/i18n_menu/i18n_menu.module
+++ b/sites/all/modules/contrib/localisation/i18n/i18n_menu/i18n_menu.module
@@ -62,8 +62,8 @@ function i18n_menu_menu_alter(&$items) {
* @param $variables
*/
function i18n_menu_preprocess_menu_admin_overview(&$variables) {
- $variables['title'] = i18n_string(array('menu', 'menu', $variables['name'], 'title'), $variables['title']);
- $variables['description'] = i18n_string(array('menu', 'menu', $variables['name'], 'description'), $variables['description']);
+ $variables['title'] = i18n_string(array('menu', 'menu', $variables['name'], 'title'), $variables['title'], array('sanitize' => FALSE));
+ $variables['description'] = i18n_string(array('menu', 'menu', $variables['name'], 'description'), $variables['description'], array('sanitize' => FALSE));
}
/**
@@ -198,7 +198,6 @@ function i18n_menu_menu_link_alter(&$item) {
// We just make sure every link has a valid language property.
if (!i18n_object_langcode($item)) {
$item['language'] = LANGUAGE_NONE;
- $item['i18n_tsid'] = 0;
}
}
@@ -398,7 +397,7 @@ function i18n_menu_localize_tree($tree, $langcode = NULL) {
if (_i18n_menu_link_process($item['link'])) {
if (!_i18n_menu_link_is_visible($item['link'], $langcode)) {
// Remove links for other languages than current.
- // Links with language wont be localized.
+ // Links with language won't be localized.
unset($tree[$index]);
// @todo Research whether the above has any advantage over:
// $item['hidden'] = TRUE;
@@ -523,7 +522,7 @@ function _i18n_menu_link_localize(&$link, $langcode = NULL) {
function _i18n_menu_link_description($link, $langcode = NULL) {
if (!empty($link['options']['attributes']['title'])) {
$key = i18n_object_info('menu_link', 'key');
- return i18n_string_translate(array('menu', 'item', $link[$key], 'description'), $link['options']['attributes']['title'], array('langcode' => $langcode));
+ return i18n_string_translate(array('menu', 'item', $link[$key], 'description'), $link['options']['attributes']['title'], array('langcode' => $langcode, 'sanitize' => FALSE));
}
else {
return NULL;
@@ -600,7 +599,7 @@ function _i18n_menu_link_is_visible($link, $langcode = NULL) {
}
/**
- * Get localizable properties for menu link checking agains the router item.
+ * Get localizable properties for menu link checking against the router item.
*/
function _i18n_menu_link_localizable_properties($link) {
$props = array();
diff --git a/sites/all/modules/contrib/localisation/i18n/i18n_node/README.txt b/sites/all/modules/contrib/localisation/i18n/i18n_node/README.txt
index 2c4bc402..c65e1c13 100644
--- a/sites/all/modules/contrib/localisation/i18n/i18n_node/README.txt
+++ b/sites/all/modules/contrib/localisation/i18n/i18n_node/README.txt
@@ -12,53 +12,78 @@ CONTENTS OF THIS FILE
INTRODUCTION
------------
-The Multilingual content module, part of the Internationalization (https://www.drupal.org/project/i18n) package, provides extended multilingual options for nodes. These options help accommodate a variety of translation workflows by controlling how the language for nodes is set.
+The Multilingual content module, part of the Internationalization
+(https://www.drupal.org/project/i18n) package, provides extended multilingual
+options for nodes. These options help accommodate a variety of translation
+workflows by controlling how the language for nodes is set.
-Note that the Multilingual content module lives in the i18n_node directory in the Internationalization package. Don't confuse this module with the core Content translation module.
+Note that the Multilingual content module lives in the i18n_node directory
+in the Internationalization package. Don't confuse this module with the core
+Content translation module.
-* For a full description of the module visit https://www.drupal.org/node/1279644
+* For a full description of the module visit:
+ https://www.drupal.org/node/1279644.
-* To submit bug reports and feature suggestions, or to track changes visit https://www.drupal.org/project/issues/i18n
+* To submit bug reports and feature suggestions, or to track changes visit
+ https://www.drupal.org/project/issues/i18n.
REQUIREMENTS
------------
-This module requires the following modules:
+This module requires the following module:
-* Internationalization (https://www.drupal.org/project/i18n)
+* Internationalization - https://www.drupal.org/project/i18n
RECOMMENDED MODULES
-------------------
-* Internationalization Views (https://www.drupal.org/project/i18nviews)
-* Language Icons (https://www.drupal.org/project/languageicons)
-* Translation Overview (https://www.drupal.org/project/translation_overview)
-* Localization Client (https://www.drupal.org/project/l10n_client)
-* Internationalization contributions (https://www.drupal.org/project/i18n_contrib)
+* Internationalization Views - https://www.drupal.org/project/i18nviews
+* Language Icons - https://www.drupal.org/project/languageicons
+* Translation Overview - https://www.drupal.org/project/translation_overview
+* Localization Client - https://www.drupal.org/project/l10n_client
+* Internationalization contributions -
+ https://www.drupal.org/project/i18n_contrib
INSTALLATION
-
------------
-* This is a submodule of the Internationalization module. Install the Internationalization module as you would normally install a contributed Drupal module. See https://www.drupal.org/docs/7/extending-drupal-7/installing-contributed-modules-find-import-enable-configure-drupal-7 for further information.
+This is a submodule of the Internationalization module. Install the
+Internationalization module as you would normally install a contributed Drupal
+module. Visit https://www.drupal.org/node/895232 for further information.
CONFIGURATION
-------------
-For each content type, the following Extended language options are available under the Multilingual Settings tab
-1. "Set current language as default for new content" can be useful for content that is community-generated.
+For each content type, the following Extended language options are available
+under the Multilingual Settings tab.
+1. "Set current language as default for new content" can be useful for content
+ that is community-generated.
2. "Require language" prevents users from creating 'Language neutral' nodes.
-3. "Lock language" prevents users from changing the language of a node after it's created.
+3. "Lock language" prevents users from changing the language of a node after
+ it's created.
Site-wide Settings for Node Translation
-1. There are also site-wide settings provided to help streamline how multilingual content is created. Navigate to Config > Regional and language > Multilingual settings > Node Options.
-2. "Switch interface for translating" switches the language of the user interface to the chosen language when a user translates a node. This is useful if users speak the language in which the translation is written. It means that after the node translation is saved, the language of the UI will match the language of the node.
-3. "Hide content translation links" will prevent the language switcher links from appearing in nodes and teasers. This is useful if a language switcher block is enabled on the site.
-4.You can also select the default language for new nodes if the corresponding content type doesn't have language support. By default, it is set to be in the default language of the site, but this can be changed to be language neutral. This is a useful option when thinking about forward compatibility for adding multilingual support to these content types in the future.
+1. There are also site-wide settings provided to help streamline how
+ multilingual content is created. Navigate to Config > Regional and language >
+ Multilingual settings > Node Options.
+2. "Switch interface for translating" switches the language of the user
+ interface to the chosen language when a user translates a node. This is
+ useful if users speak the language in which the translation is written. It
+ means that after the node translation is saved, the language of the UI will
+ match the language of the node.
+3. "Hide content translation links" will prevent the language switcher links
+ from appearing in nodes and teasers. This is useful if a language switcher
+ block is enabled on the site.
+4. The user can also select the default language for new nodes if the
+ corresponding content type doesn't have language support. By default, it is
+ set to be in the default language of the site, but this can be changed to be
+ language neutral. This is a useful option when thinking about forward
+ compatibility for adding multilingual support to these content types in the
+ future.
MAINTAINERS
diff --git a/sites/all/modules/contrib/localisation/i18n/i18n_node/i18n_node.info b/sites/all/modules/contrib/localisation/i18n/i18n_node/i18n_node.info
index 07d38f65..ba222a1e 100644
--- a/sites/all/modules/contrib/localisation/i18n/i18n_node/i18n_node.info
+++ b/sites/all/modules/contrib/localisation/i18n/i18n_node/i18n_node.info
@@ -9,9 +9,8 @@ configure = admin/config/regional/i18n/node
files[]=i18n_node.test
files[]=i18n_node.variable.inc
-; Information added by Drupal.org packaging script on 2017-01-31
-version = "7.x-1.15"
+; Information added by Drupal.org packaging script on 2020-06-17
+version = "7.x-1.27"
core = "7.x"
project = "i18n"
-datestamp = "1485834792"
-
+datestamp = "1592373390"
diff --git a/sites/all/modules/contrib/localisation/i18n/i18n_node/i18n_node.module b/sites/all/modules/contrib/localisation/i18n/i18n_node/i18n_node.module
index e5bd68b4..b6957e8f 100644
--- a/sites/all/modules/contrib/localisation/i18n/i18n_node/i18n_node.module
+++ b/sites/all/modules/contrib/localisation/i18n/i18n_node/i18n_node.module
@@ -222,8 +222,16 @@ function i18n_node_language_mode($type) {
function i18n_node_node_prepare($node) {
$options = variable_get('i18n_node_options_' . $node->type, array());
if (i18n_node_type_enabled($node) && empty($node->nid) && !i18n_object_langcode($node) && in_array('current', $options)) {
+ $default = variable_get('i18n_node_default_language_for_' . $node->type, '-- current --');
+
// Set current language for new nodes if option enabled
- $node->language = i18n_language_content()->language;
+ if ($default === '-- current --') {
+ $node->language = i18n_language_content()->language;
+ }
+ // If a custom language was specified, apply it.
+ else {
+ $node->language = $default;
+ }
}
}
@@ -249,13 +257,16 @@ function i18n_node_permission() {
/**
* Implements hook_node_view()
*/
-function i18n_node_node_view($node) {
+function i18n_node_node_view($node, $view_mode, $langcode) {
if (i18n_node_type_enabled($node)) {
- $node->content['language'] = array(
- '#type' => 'item',
- '#title' => t('Language'),
- '#markup' => i18n_language_name($node->language),
- );
+ $extra_fields_display_settings = field_extra_fields_get_display('node', $node->type, $view_mode);
+ if ($extra_fields_display_settings['language']['visible']) {
+ $node->content['language'] = array(
+ '#type' => 'item',
+ '#title' => t('Language'),
+ '#markup' => i18n_language_name($node->language),
+ );
+ }
}
}
@@ -265,7 +276,9 @@ function i18n_node_node_view($node) {
* Handles links for extended languages. Sets current interface language.
*/
function i18n_node_node_view_alter(&$build) {
- $node = $build['#node'];
+ if (isset($build['#node'])) {
+ $node = $build['#node'];
+ }
// Hide node translation links.
if (variable_get('i18n_hide_translation_links', 0)) {
if (isset($build['links']['translation'])) {
@@ -417,7 +430,16 @@ function i18n_node_form_node_type_form_alter(&$form, &$form_state) {
// Some settings about node languages. Add variables for node type from variable definition
if ($form['#node_type']->type) {
variable_type_include('node_type');
- $form['i18n'] += node_variable_type_subform($form['#node_type']->type, array('i18n_node_options', 'i18n_node_extended'));
+ $form['i18n'] += node_variable_type_subform($form['#node_type']->type, array('i18n_node_options', 'i18n_node_default_language_for', 'i18n_node_extended'));
+ // Only show custom default language field if "current" is checked.
+ $form['i18n']['i18n_node_default_language_for']['#states'] = array(
+ 'visible' => array(
+ ':input[name="i18n_node_options[current]"]' => array('checked' => TRUE),
+ ),
+ 'required' => array(
+ ':input[name="i18n_node_options[current]"]' => array('checked' => TRUE),
+ ),
+ );
}
// Add disabled message
if ($disabled) {
diff --git a/sites/all/modules/contrib/localisation/i18n/i18n_node/i18n_node.variable.inc b/sites/all/modules/contrib/localisation/i18n/i18n_node/i18n_node.variable.inc
index 9362fc3f..b9b0495f 100644
--- a/sites/all/modules/contrib/localisation/i18n/i18n_node/i18n_node.variable.inc
+++ b/sites/all/modules/contrib/localisation/i18n/i18n_node/i18n_node.variable.inc
@@ -45,13 +45,30 @@ function i18n_node_variable_info($options = array()) {
'repeat' => array(
'type' => 'options',
'options' => array(
- 'current' => t('Set current language as default for new content.', array(), $options),
+ // Note: this was previously used only to mark new, translatable nodes
+ // with the current language of the user. Now, this setting is extended
+ // to allow a specific language to be chosen (defaulting to the current
+ // language). This was done for backwards compatibility reasons.
+ 'current' => t('Set custom language as default for new content.', array(), $options),
'required' => t('Require language (Do not allow Language Neutral).', array(), $options),
'lock' => t('Lock language (Cannot be changed).', array(), $options),
),
),
'group' => 'i18n',
);
+ // This field will only be displayed if "current" is checked above.
+ $variables['i18n_node_default_language_for_[node_type]'] = array(
+ 'type' => 'multiple',
+ 'title' => t('Custom default language', array(), $options),
+ 'repeat' => array(
+ 'type' => 'select',
+ 'options' => array_merge(array(
+ '-- current --' => t('Current language')
+ ), locale_language_list('name')),
+ 'default' => '-- current --',
+ ),
+ 'group' => 'i18n',
+ );
$variables['i18n_node_extended_[node_type]'] = array(
'type' => 'multiple',
'title' => t('Extended language support'),
diff --git a/sites/all/modules/contrib/localisation/i18n/i18n_path/i18n_path.info b/sites/all/modules/contrib/localisation/i18n/i18n_path/i18n_path.info
index 5767d8b8..bb3519e0 100644
--- a/sites/all/modules/contrib/localisation/i18n/i18n_path/i18n_path.info
+++ b/sites/all/modules/contrib/localisation/i18n/i18n_path/i18n_path.info
@@ -6,9 +6,8 @@ core = 7.x
files[] = i18n_path.inc
files[] = i18n_path.test
-; Information added by Drupal.org packaging script on 2017-01-31
-version = "7.x-1.15"
+; Information added by Drupal.org packaging script on 2020-06-17
+version = "7.x-1.27"
core = "7.x"
project = "i18n"
-datestamp = "1485834792"
-
+datestamp = "1592373390"
diff --git a/sites/all/modules/contrib/localisation/i18n/i18n_redirect/README.txt b/sites/all/modules/contrib/localisation/i18n/i18n_redirect/README.txt
index 3d10403b..fd262af1 100644
--- a/sites/all/modules/contrib/localisation/i18n/i18n_redirect/README.txt
+++ b/sites/all/modules/contrib/localisation/i18n/i18n_redirect/README.txt
@@ -1,5 +1,5 @@
CONTENTS OF THIS FILE
----------------------------
+---------------------
* Introduction
* Requirements
@@ -12,50 +12,64 @@ CONTENTS OF THIS FILE
INTRODUCTION
------------
-The Redirect translation module, part of the Internationalization (https://www.drupal.org/project/i18n) package, improves search engine optimization (SEO) for multilingual websites.
+The Redirect translation module, part of the Internationalization
+(https://www.drupal.org/project/i18n) package, improves search engine
+optimization (SEO) for multilingual websites.
-It redirects anonymous users (including web crawlers) to the translation of the page in the requested language, if it exists, using a 301 redirect code.
+It redirects anonymous users (including web crawlers) to the translation of the
+page in the requested language, if it exists, using a 301 redirect code.
* For a full description of the module, visit this page:
-https://www.drupal.org/node/1280468
+ https://www.drupal.org/node/1280468.
* To submit bug reports and feature suggestions, or to track changes:
-https://www.drupal.org/project/issues/i18n
+ https://www.drupal.org/project/issues/i18n.
REQUIREMENTS
------------
-This module requires the following modules:
+This module requires the following module:
-* Internationalization (https://www.drupal.org/project/i18n)
+* Internationalization - https://www.drupal.org/project/i18n
-The Translation redirect module requires the implementation of hook_i18n_translate_path by another module for the redirect page to be determined. Currently, the Multilingual content, Path translation, and Taxonomy translation modules implement this hook.
+The Translation redirect module requires the implementation of
+hook_i18n_translate_path by another module for the redirect page to be
+determined. Currently, the Multilingual content, Path translation, and Taxonomy
+translation modules implement this hook.
RECOMMENDED MODULES
-------------------
-* Internationalization Views (https://www.drupal.org/project/i18nviews)
-* Language Icons (https://www.drupal.org/project/languageicons)
-* Translation Overview (https://www.drupal.org/project/translation_overview)
-* Localization Client (https://www.drupal.org/project/l10n_client)
-* Internationalization contributions (https://www.drupal.org/project/i18n_contrib)
+* Internationalization Views - https://www.drupal.org/project/i18nviews
+* Language Icons - https://www.drupal.org/project/languageicons
+* Translation Overview - https://www.drupal.org/project/translation_overview
+* Localization Client - https://www.drupal.org/project/l10n_client
+* Internationalization contributions -
+ https://www.drupal.org/project/i18n_contrib
INSTALLATION
------------
-* This is a submodule of the Internationalization module. Install the Internationalization module as you would normally install a contributed Drupal module. Visit https://www.drupal.org/docs/7/extending-drupal-7/installing-contributed-modules-find-import-enable-configure-drupal-7 for further information.
+This is a submodule of the Internationalization module. Install the
+Internationalization module as you would normally install a contributed Drupal
+module. Visit https://www.drupal.org/node/895232 for further information.
CONFIGURATION
-------------
-No configuration is necessary.
+No configuration is necessary.
-For node translation, enable the Multilingual content and the Translation redirect modules. For non-node pages, the redirection hook must be implemented by the relevant module.
-For example, for taxonomy pages, you should enable the Taxonomy translation module because the module provides the necessary hook code. If you are using the Path translation module to create translation sets for non-node pages, then it implements the hook code for determining the redirection page.
+For node translation, enable the Multilingual content and the Translation
+redirect modules. For non-node pages, the redirection hook must be implemented
+by the relevant module.
+For example, for taxonomy pages, you should enable the Taxonomy translation
+module because the module provides the necessary hook code. If you are using the
+Path translation module to create translation sets for non-node pages, then it
+implements the hook code for determining the redirection page.
MAINTAINERS
diff --git a/sites/all/modules/contrib/localisation/i18n/i18n_redirect/i18n_redirect.info b/sites/all/modules/contrib/localisation/i18n/i18n_redirect/i18n_redirect.info
index 229a3966..2ceeb19c 100644
--- a/sites/all/modules/contrib/localisation/i18n/i18n_redirect/i18n_redirect.info
+++ b/sites/all/modules/contrib/localisation/i18n/i18n_redirect/i18n_redirect.info
@@ -4,9 +4,8 @@ dependencies[] = i18n
package = Multilingual - Internationalization
core = 7.x
-; Information added by Drupal.org packaging script on 2017-01-31
-version = "7.x-1.15"
+; Information added by Drupal.org packaging script on 2020-06-17
+version = "7.x-1.27"
core = "7.x"
project = "i18n"
-datestamp = "1485834792"
-
+datestamp = "1592373390"
diff --git a/sites/all/modules/contrib/localisation/i18n/i18n_select/README.txt b/sites/all/modules/contrib/localisation/i18n/i18n_select/README.txt
index 8f13ddf0..ba8c432c 100644
--- a/sites/all/modules/contrib/localisation/i18n/i18n_select/README.txt
+++ b/sites/all/modules/contrib/localisation/i18n/i18n_select/README.txt
@@ -12,49 +12,64 @@ CONTENTS OF THIS FILE
INTRODUCTION
------------
-The Multilingual select module, part of the Internationalization (https://www.drupal.org/project/i18n) package, allows the user to define whether content is filtered by language on pages provided by Drupal core.
+The Multilingual select module, part of the Internationalization
+(https://www.drupal.org/project/i18n) package, allows the user to define whether
+content is filtered by language on pages provided by Drupal core.
-* For a full description of the module visit https://www.drupal.org/node/1279512
+* For a full description of the module visit:
+ https://www.drupal.org/node/1279512.
-* To submit bug reports and feature suggestions, or to track changes visit https://www.drupal.org/project/issues/i18n
+* To submit bug reports and feature suggestions, or to track changes visit
+ https://www.drupal.org/project/issues/i18n.
REQUIREMENTS
------------
-This module requires the following modules:
+This module requires the following module:
-* Internationalization (https://www.drupal.org/project/i18n)
-* Variable (https://www.drupal.org/project/variable)
+* Internationalization - https://www.drupal.org/project/i18n
+* Variable - https://www.drupal.org/project/variable
RECOMMENDED MODULES
-------------------
-* Internationalization Views (https://www.drupal.org/project/i18nviews)
-* Language Icons (https://www.drupal.org/project/languageicons)
-* Translation Overview (https://www.drupal.org/project/translation_overview)
-* Localization Client (https://www.drupal.org/project/l10n_client)
-* Internationalization contributions (https://www.drupal.org/project/i18n_contrib)
+* Internationalization Views - https://www.drupal.org/project/i18nviews
+* Language Icons - https://www.drupal.org/project/languageicons
+* Translation Overview - https://www.drupal.org/project/translation_overview
+* Localization Client - https://www.drupal.org/project/l10n_client
+* Internationalization contributions -
+ https://www.drupal.org/project/i18n_contrib
INSTALLATION
------------
-* This is a submodule of the Internationalization module. Install the Internationalization module as you would normally install a contributed Drupal module. See https://www.drupal.org/docs/7/extending-drupal-7/installing-contributed-modules-find-import-enable-configure-drupal-7 for further information.
+This is a submodule of the Internationalization module. Install the
+Internationalization module as you would normally install a contributed Drupal
+module. Visit https://www.drupal.org/node/895232 for further information.
CONFIGURATION
-------------
-The module allows you to configure whether or not to filter pages by the current language. If the Taxonomy translation submodule is also enabled, an option will be available for how taxonomy term pages are filtered. It also allows the exclusion of the module’s language selection handling for some elements and certain paths.
+The module allows the user to configure whether or not to filter pages by the
+current language. If the Taxonomy translation submodule is also enabled, an
+option will be available for how taxonomy term pages are filtered. It also
+allows the exclusion of the module’s language selection handling for some
+elements and certain paths.
1. Enable the Multilingual select module included with Internationalization.
-2. Go to Configuration > Regional and language > Multilingual settings > Selection.
-3. Select nodes and taxonomy can be filtered by language in the Content to Filter by Language field set.
-4. The "Content Selection Mode" allows content with specific tags to be skipped by entering a list of tags.
-5. The "Enable for Specific Pages" field set allows specific pages to be included by path.
-6. After making choices click Save configuration.
+2. Navigate to Configuration > Regional and language > Multilingual settings >
+ Selection.
+3. Select nodes and taxonomy can be filtered by language in the Content to
+ Filter by Language field set.
+4. The "Content Selection Mode" allows content with specific tags to be skipped
+ by entering a list of tags.
+5. The "Enable for Specific Pages" field set allows specific pages to be
+ included by path.
+6. After making choices, Save configuration.
MAINTAINERS
diff --git a/sites/all/modules/contrib/localisation/i18n/i18n_select/i18n_select.info b/sites/all/modules/contrib/localisation/i18n/i18n_select/i18n_select.info
index 74455ffd..5c72eab5 100644
--- a/sites/all/modules/contrib/localisation/i18n/i18n_select/i18n_select.info
+++ b/sites/all/modules/contrib/localisation/i18n/i18n_select/i18n_select.info
@@ -6,9 +6,8 @@ core = 7.x
configure = admin/config/regional/i18n/select
files[] = i18n_select.test
-; Information added by Drupal.org packaging script on 2017-01-31
-version = "7.x-1.15"
+; Information added by Drupal.org packaging script on 2020-06-17
+version = "7.x-1.27"
core = "7.x"
project = "i18n"
-datestamp = "1485834792"
-
+datestamp = "1592373390"
diff --git a/sites/all/modules/contrib/localisation/i18n/i18n_string/README.txt b/sites/all/modules/contrib/localisation/i18n/i18n_string/README.txt
index 0e6645ae..673a3f3e 100644
--- a/sites/all/modules/contrib/localisation/i18n/i18n_string/README.txt
+++ b/sites/all/modules/contrib/localisation/i18n/i18n_string/README.txt
@@ -12,54 +12,76 @@ CONTENTS OF THIS FILE
INTRODUCTION
------------
-The String translation module, part of the Internationalization (https://www.drupal.org/project/i18n) package, provides support for other modules to translate user-defined strings. This is an API module that must be enabled only when required by other modules in the i18n package.
+The String translation module, part of the Internationalization
+(https://www.drupal.org/project/i18n) package, provides support for other
+modules to translate user-defined strings. This is an API module that must be
+enabled only when required by other modules in the i18n package.
* For a full description of the module, visit this page:
-https://www.drupal.org/node/1279668
+ https://www.drupal.org/node/1279668
* To submit bug reports and feature suggestions, or to track changes:
-https://www.drupal.org/project/issues/i18n
+ https://www.drupal.org/project/issues/i18n
REQUIREMENTS
------------
-This module requires the following modules:
+This module requires the following module:
-Internationalization (https://www.drupal.org/project/i18n)
+* Internationalization - https://www.drupal.org/project/i18n
RECOMMENDED MODULES
-------------------
-* Internationalization Views (https://www.drupal.org/project/i18nviews)
-* Language Icons (https://www.drupal.org/project/languageicons)
-* Translation Overview (https://www.drupal.org/project/translation_overview)
-* Localization Client (https://www.drupal.org/project/l10n_client)
-* Internationalization contributions (https://www.drupal.org/project/i18n_contrib)
+* Internationalization Views - https://www.drupal.org/project/i18nviews
+* Language Icons - https://www.drupal.org/project/languageicons
+* Translation Overview - https://www.drupal.org/project/translation_overview
+* Localization Client - https://www.drupal.org/project/l10n_client
+* Internationalization contributions -
+ https://www.drupal.org/project/i18n_contrib
INSTALLATION
------------
-* This is a submodule of the Internationalization module. Install the Internationalization module as you would normally install a contributed Drupal module. Visit https://www.drupal.org/docs/7/extending-drupal-7/installing-contributed-modules-find-import-enable-configure-drupal-7 for further information.
+This is a submodule of the Internationalization module. Install the
+Internationalization module as you would normally install a contributed Drupal
+module. Visit https://www.drupal.org/node/895232 for further information.
CONFIGURATION
-------------
-Strings will be translated from the source languages. By default the source language is the site's default language, so changing the default language could break these translations.
+Strings will be translated from the source languages. By default the source
+language is the site's default language, so changing the default language could
+break these translations.
-1. You can set which language is used as the source language via Administration > Configuration > Regional and language > Multilingual settings > Strings. By default, only plain strings are enabled, so regular blocks are not fully translatable.
-2. To allow Filtered HTML, Full HTML or Plain text select the appropriate radio box(es) and Save configuration.
-3. To select the strings to be translated navigate to Administration > Configuration > Regional and language > Translate interface and select on Stings vertical tab. From here you can select which text groups to translate and select the Refresh strings tab.
+1. The user can set which language is used as the source language via
+ Administration > Configuration > Regional and language > Multilingual
+ settings > Strings. By default, only plain strings are enabled, so regular
+ blocks are not fully translatable.
+2. To allow Filtered HTML, Full HTML or Plain text select the appropriate radio
+ box(es) and Save configuration.
+3. To select the strings to be translated navigate to Administration >
+ Configuration > Regional and language > Translate interface and select on
+ Stings vertical tab. From here the user can select which text groups to
+ translate and select the Refresh strings tab.
FAQ
---
-The String translation module allows you to configure which text formats are translatable. Formats like PHP Filter and Full HTML are translated before they are processed, so allowing a translator to edit these can be a security risk. This is particularly problematic when importing translations in bulk from a CSV file, since the translator's access to the import formats isn't verified by Drupal. After updating this setting, be sure to refresh the strings via Administration > Configuration > Regional and language > Translate interface > Strings so that strings in forbidden formats are deleted.
+The String translation module allows you to configure which text formats are
+translatable. Formats like PHP Filter and Full HTML are translated before they
+are processed, so allowing a translator to edit these can be a security risk.
+This is particularly problematic when importing translations in bulk from a CSV
+file, since the translator's access to the import formats isn't verified by
+Drupal. After updating this setting, be sure to refresh the strings via
+Administration > Configuration > Regional and language > Translate interface >
+Strings so that strings in forbidden formats are deleted.
MAINTAINERS
diff --git a/sites/all/modules/contrib/localisation/i18n/i18n_string/i18n_string.inc b/sites/all/modules/contrib/localisation/i18n/i18n_string/i18n_string.inc
index 33fa444d..65b4efa7 100644
--- a/sites/all/modules/contrib/localisation/i18n/i18n_string/i18n_string.inc
+++ b/sites/all/modules/contrib/localisation/i18n/i18n_string/i18n_string.inc
@@ -703,9 +703,19 @@ class i18n_string_textgroup_default {
// Create source string so we get an lid
$this->save_source($string);
}
+
+ // Convert objectid to objectkey if it's numeric.
if (!isset($string->objectkey)) {
- $string->objectkey = (int)$string->objectid;
+ if (is_numeric($string->objectid)) {
+ $string->objectkey = (int)$string->objectid;
+ }
}
+
+ // Make sure objectkey is numeric.
+ if (!is_numeric($string->objectkey)) {
+ $string->objectkey = 0;
+ }
+
if (!isset($string->format)) {
$string->format = '';
}
@@ -1166,10 +1176,17 @@ class i18n_string_object_wrapper extends i18n_object_wrapper {
$info = is_array($info) ? $info : array('title' => $info);
$field_name = isset($info['field']) ? $info['field'] : $field;
$value = $this->get_field($field_name);
+ if (is_array($value) && isset($value['value'])) {
+ $format = isset($value['format']) ? $value['format'] : NULL;
+ $value = $value['value'];
+ }
+ else {
+ $format = isset($info['format']) ? $this->get_field($info['format']) : NULL;
+ }
$strings[$this->get_textgroup()][$string_type][$object_id][$field] = array(
'string' => is_array($value) || isset($info['empty']) && $value === $info['empty'] ? NULL : $value,
'title' => $info['title'],
- 'format' => isset($info['format']) ? $this->get_field($info['format']) : NULL,
+ 'format' => $format,
'name' => array_merge($object_keys, array($field)),
);
}
@@ -1481,7 +1498,12 @@ class i18n_string_textgroup_cached extends i18n_string_textgroup_default {
foreach ($context as $key => $value) {
if ($value != '*') {
$try = array_merge($context, array($key => '*'));
- return $this->multiple_cache_get($try);
+ $cached_results = $this->multiple_cache_get($try);
+ // Now filter the ones that actually match.
+ if (!empty($cached_results)) {
+ $cached_results = $this->string_filter($cached_results, $context);
+ }
+ return $cached_results;
}
}
}
diff --git a/sites/all/modules/contrib/localisation/i18n/i18n_string/i18n_string.info b/sites/all/modules/contrib/localisation/i18n/i18n_string/i18n_string.info
index b6961b4e..327539ee 100644
--- a/sites/all/modules/contrib/localisation/i18n/i18n_string/i18n_string.info
+++ b/sites/all/modules/contrib/localisation/i18n/i18n_string/i18n_string.info
@@ -10,9 +10,8 @@ files[] = i18n_string.inc
files[] = i18n_string.test
configure = admin/config/regional/i18n/strings
-; Information added by Drupal.org packaging script on 2017-01-31
-version = "7.x-1.15"
+; Information added by Drupal.org packaging script on 2020-06-17
+version = "7.x-1.27"
core = "7.x"
project = "i18n"
-datestamp = "1485834792"
-
+datestamp = "1592373390"
diff --git a/sites/all/modules/contrib/localisation/i18n/i18n_string/i18n_string.install b/sites/all/modules/contrib/localisation/i18n/i18n_string/i18n_string.install
index 30e8cd26..23987920 100644
--- a/sites/all/modules/contrib/localisation/i18n/i18n_string/i18n_string.install
+++ b/sites/all/modules/contrib/localisation/i18n/i18n_string/i18n_string.install
@@ -94,6 +94,7 @@ function i18n_string_schema() {
),
'objectindex' => array(
'type' => 'int',
+ 'size' => 'big',
'not null' => TRUE,
'default' => 0,
'description' => 'Integer value of Object ID.',
@@ -245,6 +246,24 @@ function i18n_string_update_7002() {
}
}
+/**
+ * Removed due to buggy upgrade for #2200647.
+ */
+function i18n_string_update_7003() {
+}
+
+/**
+ * Change objectindex from int to bigint.
+ */
+function i18n_string_update_7004() {
+ db_change_field('i18n_string', 'objectindex', 'objectindex', array(
+ 'type' => 'int',
+ 'size' => 'big',
+ 'not null' => TRUE,
+ 'default' => 0,
+ 'description' => 'Integer value of Object ID.',
+ ));
+}
/**
* Notes for update script
diff --git a/sites/all/modules/contrib/localisation/i18n/i18n_string/i18n_string.module b/sites/all/modules/contrib/localisation/i18n/i18n_string/i18n_string.module
index 9c232c08..1fe45d6b 100644
--- a/sites/all/modules/contrib/localisation/i18n/i18n_string/i18n_string.module
+++ b/sites/all/modules/contrib/localisation/i18n/i18n_string/i18n_string.module
@@ -118,13 +118,14 @@ function i18n_string_menu() {
'file' => 'i18n_string.admin.inc',
'access arguments' => array('translate interface'),
);
+
$items['admin/config/regional/i18n/strings'] = array(
'title' => 'Strings',
'description' => 'Options for user defined strings.',
'weight' => 20,
'type' => MENU_LOCAL_TASK,
'page callback' => 'drupal_get_form',
- 'page arguments' => array('variable_edit_form', array('i18n_string_allowed_formats', 'i18n_string_source_language')),
+ 'page arguments' => array('variable_edit_form', array('i18n_string_allowed_formats', 'i18n_string_source_language', 'i18n_string_textgroup_class_[textgroup]')),
'access arguments' => array('administer site configuration'),
);
// AJAX callback path for strings.
@@ -258,6 +259,34 @@ function i18n_string_locale_translate_import_form_submit($form, &$form_state) {
}
}
+/**
+ * Implements hook_element_info_alter().
+ *
+ * We need to do this on the element info level as wysiwyg also does so and form
+ * API (incorrectly) does not merge in the defaults for values that are arrays.
+ */
+function i18n_string_element_info_alter(&$types) {
+ $types['text_format']['#pre_render'][] = 'i18n_string_pre_render_text_format';
+}
+
+/**
+ * The '#pre_render' function to alter the text format element in a translation.
+ * The text format for a translation is taken form the original, so the text
+ * format drop down should be disabled.
+ *
+ * @param array $element
+ * The text_format element which will be rendered.
+ *
+ * @return array
+ * The altered text_format element with a disabled "Text format" select.
+ */
+function i18n_string_pre_render_text_format($element) {
+ if (!empty($element['#i18n_string_is_translation'])) {
+ $element['format']['format']['#attributes']['disabled'] = TRUE;
+ }
+ return $element;
+}
+
/**
* Check if translation is required for this language code.
*
@@ -334,7 +363,10 @@ function i18n_string_update_context($oldname, $newname) {
}
/**
- * Get textgroup handler
+ * Get textgroup handler.
+ *
+ * @return i18n_string_textgroup_default
+ *
*/
function i18n_string_textgroup($textgroup) {
$groups = &drupal_static(__FUNCTION__);
@@ -488,6 +520,19 @@ function i18n_string_group_info($group = NULL, $property = NULL, $default = NULL
}
}
+/**
+ * Implements hook_i18n_string_info_alter().
+ *
+ * Set determined classes to use for the text group.
+ */
+function i18n_string_i18n_string_info_alter(&$info) {
+ foreach (array_keys($info) as $name) {
+ // If class is not defined. Classes from other modules, fixed classes and etc.
+ if (!isset($info[$name]['class'])) {
+ $info[$name]['class'] = variable_get('i18n_string_textgroup_class_' . $name, 'i18n_string_textgroup_default');
+ }
+ }
+}
/**
* Translate / update multiple strings
@@ -519,11 +564,12 @@ function i18n_string_multiple($operation, $name, $strings, $options = array()) {
*
* This function is intended to return translations for plain strings that have NO text format
*
- * @param $name
+ * @param array|string name
* Array or string concatenated with ':' that contains textgroup and string context
- * @param $string
- * String in default language or array of strings to be translated
- * @param $options
+ * @param array|string $string
+ * A string in the default language, a string wth format (array with keys
+ * value and format),or an array of strings (without format) to be translated.
+ * @param array $options
* An associative array of additional options, with the following keys:
* - 'langcode' (defaults to the current language) The language code to translate to a language other than what is used to display the page.
* - 'filter' Filtering callback to apply to the translated string only
@@ -531,8 +577,13 @@ function i18n_string_multiple($operation, $name, $strings, $options = array()) {
* - 'callback' Callback to apply to the result (both to translated or untranslated string
* - 'sanitize' Whether to filter the translation applying the text format if any, default is TRUE
* - 'sanitize default' Whether to filter the default value if no translation found, default is FALSE
+ *
+ * @return string
*/
function i18n_string_translate($name, $string, $options = array()) {
+ if (is_array($string) && isset($string['value'])) {
+ $string = $string['value'];
+ }
if (is_array($string)) {
return i18n_string_translate_list($name, $string, $options);
}
@@ -583,10 +634,17 @@ function i18n_string_translate_access($string_format, $account = NULL) {
* Message if the user cannot translate that string.
*/
function i18n_string_translate_check_string($i18nstring, $account = NULL) {
- if (!user_access('translate interface', $account) || !user_access('translate user-defined strings', $account)) {
+ // Check block translation permissions.
+ if ($i18nstring->textgroup == 'blocks') {
+ if (!user_access('translate interface', $account) && !user_access('translate blocks', $account)) {
+ return t('This is a user-defined string within a block. You are not allowed to translate blocks.');
+ }
+ }
+ elseif (!user_access('translate interface', $account) || !user_access('translate user-defined strings', $account)) {
return t('This is a user-defined string. You are not allowed to translate these strings.');
}
- elseif (!empty($i18nstring->format)) {
+
+ if (!empty($i18nstring->format)) {
if (!i18n_string_allowed_format($i18nstring->format)) {
$format = filter_format_load($i18nstring->format);
return t('This string uses the %name text format. Strings with this format are not allowed for translation.', array('%name' => $format->name));
diff --git a/sites/all/modules/contrib/localisation/i18n/i18n_string/i18n_string.pages.inc b/sites/all/modules/contrib/localisation/i18n/i18n_string/i18n_string.pages.inc
index 4d0da59c..fd657b5a 100644
--- a/sites/all/modules/contrib/localisation/i18n/i18n_string/i18n_string.pages.inc
+++ b/sites/all/modules/contrib/localisation/i18n/i18n_string/i18n_string.pages.inc
@@ -170,14 +170,16 @@ function i18n_string_translate_page_form_base($form, $langcode, $redirect = NULL
/**
* Create field elements for strings
+ *
+ * @param i18n_string_object[] $strings
+ * @param string $langcode
+ *
+ * @return array
*/
function i18n_string_translate_page_form_strings($strings, $langcode) {
- $formats = filter_formats();
+ global $user;
+ $form = array();
foreach ($strings as $item) {
- // We may have a source or not. Load it, our string may get the format from it.
- $source = $item->get_source();
- $format_id = $source ? $source->format : $item->format;
- $description = '';
// Check permissions to translate this string, depends on format, etc..
if ($message = $item->check_translate_access()) {
// We'll display a disabled element with the reason it cannot be translated.
@@ -188,27 +190,31 @@ function i18n_string_translate_page_form_strings($strings, $langcode) {
$disabled = FALSE;
$description = '';
// If we don't have a source and it can be translated, we create it.
- if (!$source) {
+ if (!$item->get_source()) {
// Enable messages just as a reminder these strings are not being updated properly.
$status = $item->update(array('messages' => TRUE));
if ($status === FALSE || $status === SAVED_DELETED) {
// We don't have a source string so nothing to translate here
$disabled = TRUE;
}
- else {
- $source = $item->get_source();
- }
}
}
$default_value = $item->format_translation($langcode, array('langcode' => $langcode, 'sanitize' => FALSE, 'debug' => FALSE));
+ $available_formats = array_keys(filter_formats($user));
+ if (!in_array($item->format, $available_formats)) {
+ $item->format = NULL;
+ }
$form[$item->get_name()] = array(
'#title' => $item->get_title(),
- '#type' => 'textarea',
+ '#type' => $item->format ? 'text_format' : 'textarea',
'#default_value' => $default_value,
+ '#format' => $item->format,
+ // This will trigger i18n_string_pre_render_text_format() to actually
+ // alter the element.
+ '#i18n_string_is_translation' => TRUE,
'#disabled' => $disabled,
- '#description' => $description . _i18n_string_translate_format_help($format_id),
- //'#i18n_string_format' => $source ? $source->format : 0,
+ '#description' => $description,
// If disabled, provide smaller textarea (that can be expanded anyway).
'#rows' => $disabled ? 1 : min(ceil(str_word_count($default_value) / 12), 10),
// Change the parent for disabled strings so we don't get empty values later
@@ -226,6 +232,16 @@ function i18n_string_translate_page_form_submit($form, &$form_state) {
foreach ($form_state['values']['strings'] as $name => $value) {
$count++;
list($textgroup, $context) = i18n_string_context(explode(':', $name));
+ if (is_array($value)) {
+ if (isset($value['value'])) {
+ $value = $value['value'];
+ $form_state['values']['strings'][$name] = $value;
+ }
+ else {
+ form_set_error("strings][$name", t('Unable to get the translated string value.'));
+ watchdog('locale', 'Unable to get the translated string value, string array is: %string', array('%string' => var_dump($value)), WATCHDOG_WARNING);
+ }
+ }
$result = i18n_string_textgroup($textgroup)->update_translation($context, $form_state['values']['langcode'], $value);
$success += ($result ? 1 : 0);
}
diff --git a/sites/all/modules/contrib/localisation/i18n/i18n_string/i18n_string.test b/sites/all/modules/contrib/localisation/i18n/i18n_string/i18n_string.test
index d4563405..9e52dfa0 100644
--- a/sites/all/modules/contrib/localisation/i18n/i18n_string/i18n_string.test
+++ b/sites/all/modules/contrib/localisation/i18n/i18n_string/i18n_string.test
@@ -65,7 +65,7 @@ class i18nStringTestCase extends Drupali18nTestCase {
$this->drupalPost('admin/config/regional/translate/translate', $search, t('Filter'));
$this->clickLink(t('edit'));
// Just add a random translation.
- $translation = $this->randomString();
+ $translation = $this->randomName();
$edit = array();
foreach ($this->getOtherLanguages() as $language) {
$langcode = $language->language;
diff --git a/sites/all/modules/contrib/localisation/i18n/i18n_string/i18n_string.variable.inc b/sites/all/modules/contrib/localisation/i18n/i18n_string/i18n_string.variable.inc
index cb677e3c..932751f1 100644
--- a/sites/all/modules/contrib/localisation/i18n/i18n_string/i18n_string.variable.inc
+++ b/sites/all/modules/contrib/localisation/i18n/i18n_string/i18n_string.variable.inc
@@ -34,9 +34,32 @@ function i18n_string_variable_info($options = array()) {
'default' => 0,
'group' => 'debug',
);
+ $variables['i18n_string_textgroup_class_[textgroup]'] = array(
+ 'title' => t('Class to use for the text group'),
+ 'description' => t('Determines which the class will be use for string translation in the text group.', array(), $options),
+ 'repeat' => array(
+ 'type' => 'select',
+ 'default' => 'i18n_string_textgroup_default',
+ 'options callback' => 'i18n_string_variable_textgroup_class_list',
+ ),
+ 'submit callback' => 'i18n_string_variable_textgroup_class_submit_callback',
+ 'group' => 'i18n',
+ );
return $variables;
}
+/**
+ * Implements hook_variable_type_info().
+ */
+function i18n_string_variable_type_info() {
+ $type['textgroup'] = array(
+ 'title' => t('Text group'),
+ 'type' => 'select',
+ 'options callback' => 'i18n_string_variable_textgroup_list',
+ );
+ return $type;
+}
+
/**
* Options callback, format list
*/
@@ -54,4 +77,33 @@ function i18n_string_variable_format_list() {
*/
function i18n_string_variable_format_default() {
return array(filter_fallback_format());
-}
\ No newline at end of file
+}
+
+/**
+ * Options callback, text groups list.
+ */
+function i18n_string_variable_textgroup_list() {
+ $groups = array();
+ foreach (i18n_string_group_info() as $name => $info) {
+ $groups[$name] = $info['title'];
+ }
+ return $groups;
+}
+
+/**
+ * Options callback, text group classes list.
+ */
+function i18n_string_variable_textgroup_class_list($variable, $options = array()) {
+ return array(
+ 'i18n_string_textgroup_default' => t('Text group handler default.', array(), $options),
+ 'i18n_string_textgroup_cached' => t('Text group handler which include persistent caching.', array(), $options),
+ );
+}
+
+/**
+ * Submit callback. Execute Reset the persistent caches after save the text group class variables.
+ */
+function i18n_string_variable_textgroup_class_submit_callback($variable, $options, $form, $form_state) {
+ // Reset the persistent caches.
+ cache_clear_all('i18n:string:' , 'cache', TRUE);
+}
diff --git a/sites/all/modules/contrib/localisation/i18n/i18n_sync/README.txt b/sites/all/modules/contrib/localisation/i18n/i18n_sync/README.txt
index ce7ea6aa..c106dcb6 100644
--- a/sites/all/modules/contrib/localisation/i18n/i18n_sync/README.txt
+++ b/sites/all/modules/contrib/localisation/i18n/i18n_sync/README.txt
@@ -3,7 +3,7 @@ README.txt
==========
Drupal module: i18n_sync (Synchronization)
-This module will handle content synchronization accross translations.
+This module will handle content synchronization across translations.
The available list of fields to synchronize will include standard node fields and cck fields.
To have aditional fields, add the list in a variable in the settings.php file, like this:
diff --git a/sites/all/modules/contrib/localisation/i18n/i18n_sync/i18n_sync.info b/sites/all/modules/contrib/localisation/i18n/i18n_sync/i18n_sync.info
index c91f89ed..ec5912f5 100644
--- a/sites/all/modules/contrib/localisation/i18n/i18n_sync/i18n_sync.info
+++ b/sites/all/modules/contrib/localisation/i18n/i18n_sync/i18n_sync.info
@@ -1,5 +1,5 @@
name = Synchronize translations
-description = Synchronizes taxonomy and fields accross translations of the same content.
+description = Synchronizes taxonomy and fields across translations of the same content.
dependencies[] = i18n
dependencies[] = translation
package = Multilingual - Internationalization
@@ -10,9 +10,8 @@ files[] = i18n_sync.install
files[] = i18n_sync.module.inc
files[] = i18n_sync.node.inc
files[] = i18n_sync.test
-; Information added by Drupal.org packaging script on 2017-01-31
-version = "7.x-1.15"
+; Information added by Drupal.org packaging script on 2020-06-17
+version = "7.x-1.27"
core = "7.x"
project = "i18n"
-datestamp = "1485834792"
-
+datestamp = "1592373390"
diff --git a/sites/all/modules/contrib/localisation/i18n/i18n_sync/i18n_sync.module b/sites/all/modules/contrib/localisation/i18n/i18n_sync/i18n_sync.module
index 8aaadbec..8a5ec5c3 100644
--- a/sites/all/modules/contrib/localisation/i18n/i18n_sync/i18n_sync.module
+++ b/sites/all/modules/contrib/localisation/i18n/i18n_sync/i18n_sync.module
@@ -33,7 +33,7 @@ function i18n_sync($status = NULL) {
function i18n_sync_help($path, $arg) {
switch ($path) {
case 'admin/help#i18n_sync' :
- $output = '' . t('This module synchronizes content taxonomy and fields accross translations:') . '
';
+ $output = '' . t('This module synchronizes content taxonomy and fields across translations:') . '
';
$output .= '' . t('First you need to select which fields should be synchronized. Then, after a node has been updated, all enabled vocabularies and fields will be synchronized as follows:') . '
';
$output .= '';
$output .= '- ' . t('All the node fields selected for synchronization will be set to the same value for all translations.') . '
';
@@ -91,6 +91,7 @@ function i18n_sync_form_node_type_form_alter(&$form, &$form_state) {
$form['i18n_sync']['i18n_sync_node_type'] = array(
'#tree' => TRUE,
+ '#weight' => 1,
);
// Each set provides title and options. We build a big checkboxes control for it to be
@@ -121,6 +122,21 @@ function i18n_sync_form_node_type_form_alter(&$form, &$form_state) {
);
}
}
+
+ // Add option to restrict syncing only when editing the translation source.
+ $form['i18n_sync']['i18n_sync_source_description'] = array(
+ '#prefix' => '', '#suffix' => '
',
+ '#markup' => t('Restrict synchronization to the translation source.'),
+ '#weight' => 2,
+ );
+ $form['i18n_sync']['i18n_sync_source'] = array(
+ '#type' => 'checkbox',
+ '#title' => t('Synchronize translations only when saving the translation source'),
+ '#default_value' => variable_get('i18n_sync_source_' . $type, FALSE),
+ '#disabled' => $disabled,
+ '#weight' => 3,
+ '#description' => t('If not checked each node will trigger the synchronization, whether it\'s the source or not.'),
+ );
}
}
@@ -167,9 +183,17 @@ function i18n_sync_node_insert($node) {
*/
function i18n_sync_node_update($node) {
// Let's go with field synchronization.
- if (i18n_sync_node_check($node) && !empty($node->tnid) && ($fields = i18n_sync_node_fields($node->type)) && ($translations = i18n_sync_node_get_translations($node, TRUE))) {
- module_load_include('node.inc', 'i18n_sync');
- i18n_sync_node_translation($node, $translations, $fields, 'update');
+ if (i18n_sync_node_check($node) && !empty($node->tnid) && (!variable_get('i18n_sync_source_' . $node->type, TRUE) || $node->tnid == $node->nid) && ($fields = i18n_sync_node_fields($node->type)) && ($translations = i18n_sync_node_get_translations($node, TRUE))) {
+ $do_sync = TRUE;
+ if (module_exists('entity_translation')) {
+ if (entity_translation_enabled_bundle('node', $node->type)) {
+ $do_sync = FALSE;
+ }
+ }
+ if ($do_sync) {
+ module_load_include('node.inc', 'i18n_sync');
+ i18n_sync_node_translation($node, $translations, $fields, 'update');
+ }
}
}
diff --git a/sites/all/modules/contrib/localisation/i18n/i18n_sync/i18n_sync.node.inc b/sites/all/modules/contrib/localisation/i18n/i18n_sync/i18n_sync.node.inc
index 8ccad676..8b09427a 100644
--- a/sites/all/modules/contrib/localisation/i18n/i18n_sync/i18n_sync.node.inc
+++ b/sites/all/modules/contrib/localisation/i18n/i18n_sync/i18n_sync.node.inc
@@ -98,7 +98,7 @@ function i18n_sync_node_translation_nodereference_field(&$node, &$translation, $
* Example:
* English A references English B and English C.
* English A and B are translated to German A and B, but English C is not.
- * The syncronization from English A to German A would it German B and English C.
+ * The synchronization from English A to German A would it German B and English C.
*/
function i18n_sync_node_translation_reference_field(&$reference_node, $default_value, $langcode) {
if (isset($reference_node->tnid) && translation_supported_type($reference_node->type)) {
diff --git a/sites/all/modules/contrib/localisation/i18n/i18n_taxonomy/README.txt b/sites/all/modules/contrib/localisation/i18n/i18n_taxonomy/README.txt
index 0813883a..4e1dfb33 100644
--- a/sites/all/modules/contrib/localisation/i18n/i18n_taxonomy/README.txt
+++ b/sites/all/modules/contrib/localisation/i18n/i18n_taxonomy/README.txt
@@ -12,17 +12,23 @@ CONTENTS OF THIS FILE
INTRODUCTION
------------
-The Taxonomy translation module, part of the Internationalization (https://www.drupal.org/project/i18n) package, provides multiple options to translate taxonomy vocabularies and terms. For each vocabulary, there are four types of behaviors to choose from: Language-independent terms, Language-specific terms, Localized terms, and Mixed-language vocabulary.
+The Taxonomy translation module, part of the Internationalization
+(https://www.drupal.org/project/i18n) package, provides multiple options to
+translate taxonomy vocabularies and terms. For each vocabulary, there are four
+types of behaviors to choose from: Language-independent terms, Language-specific
+terms, Localized terms, and Mixed-language vocabulary.
-* For a full description of the module visit https://www.drupal.org/node/1114016
+* For a full description of the module visit:
+ https://www.drupal.org/node/1114016
-* To submit bug reports and feature suggestions, or to track changes visit https://www.drupal.org/project/issues/i18n
+* To submit bug reports and feature suggestions, or to track changes visit:
+ https://www.drupal.org/project/issues/i18n
REQUIREMENTS
------------
-This module requires the following modules:
+This module requires the following module:
* Internationalization - https://www.drupal.org/project/i18n
@@ -34,13 +40,16 @@ RECOMMENDED MODULES
* Language Icons - https://www.drupal.org/project/languageicons
* Translation Overview - https://www.drupal.org/project/translation_overview
* Localization Client - https://www.drupal.org/project/l10n_client
-* Internationalization contributions - https://www.drupal.org/project/i18n_contrib
+* Internationalization contributions -
+ https://www.drupal.org/project/i18n_contrib
INSTALLATION
------------
-* This is a submodule of the Internationalization module. Install the Internationalization module as you would normally install a contributed Drupal module. Visit https://www.drupal.org/docs/7/extending-drupal-7/installing-contributed-modules-find-import-enable-configure-drupal-7 for further information.
+This is a submodule of the Internationalization module. Install the
+Internationalization module as you would normally install a contributed Drupal
+module. Visit https://www.drupal.org/node/895232 for further information.
CONFIGURATION
@@ -51,29 +60,37 @@ Language-independent terms - only vocabulary will be translatable.
2. Select the "edit vocabulary" link.
3. Select the "No multilingual options for terms".
-Language-specific terms - vocabulary is only used for content in that language. The terms will only be available if the term language matches the UI language.
+Language-specific terms - vocabulary is only used for content in that language.
+The terms will only be available if the term language matches the UI language.
1. Navigate to Structure > Taxonomy and select the "edit vocabulary link".
2. Choose "Fixed Language" and a Language drop-down field will be displayed.
3. Select the language.
4. Select "Fixed Language" and Save.
-Localized terms - Terms are common for all languages, but their name and description may be localized.
+Localized terms - Terms are common for all languages, but their name and
+description may be localized.
1. Navigate to Structure > Taxonomy > vocabulary-to-edit > Edit.
2. Select "Localize" and select Save.
3. Edit a term and there will be a Translate tab. Select this tab.
-4. Select Translate, translate the Name and Description, select "Save translation", and repeat for all languages.
+4. Select Translate, translate the Name and Description, select
+ "Save translation", and repeat for all languages.
5. Repeat the process for all terms.
6. Navigate to Structure > Content types > term-to-edit > Manage display.
-7. By default, the term reference is set to Link. Change this to "Link (localized)" and Save.
+7. By default, the term reference is set to Link. Change this to "Link
+ (localized)" and Save.
The vocabulary will be appropriate for the language.
-Mixed-language vocabulary - Use for vocabularies with terms in multiple languages.
+Mixed-language vocabulary - Use for vocabularies with terms in multiple
+languages.
1. Navigate to Structure > Taxonomy > vocabulary-to-edit > Edit.
2. Select the Translate radio button and Save.
-3. Edit a vocabulary term and there will be a new Language field. Choose a language and then select Save and translate.
-4. There are two options, the user can either select "Add translation link" or the user can select an existing term in the Select translations form.
+3. Edit a vocabulary term and there will be a new Language field. Choose a
+ language and then select Save and translate.
+4. There are two options, the user can either select "Add translation link" or
+ the user can select an existing term in the Select translations form.
5. Create translations for the terms and add terms for specific languages only.
-Now if the user edits a node associated with this vocabulary, only the relevant terms will appear.
+Now if the user edits a node associated with this vocabulary, only the relevant
+terms will appear.
MAINTAINERS
diff --git a/sites/all/modules/contrib/localisation/i18n/i18n_taxonomy/i18n_taxonomy.admin.inc b/sites/all/modules/contrib/localisation/i18n/i18n_taxonomy/i18n_taxonomy.admin.inc
index bbc35a06..c48612b1 100644
--- a/sites/all/modules/contrib/localisation/i18n/i18n_taxonomy/i18n_taxonomy.admin.inc
+++ b/sites/all/modules/contrib/localisation/i18n/i18n_taxonomy/i18n_taxonomy.admin.inc
@@ -48,7 +48,7 @@ function i18n_taxonomy_translation_term_form($form, $form_state, $vocabulary, $t
$form['translations'][$lang] = array(
'#title' => $langname,
'#type' => 'item',
- '#markup' => $source->name,
+ '#markup' => check_plain($source->name),
'#langcode' => $lang,
);
}
diff --git a/sites/all/modules/contrib/localisation/i18n/i18n_taxonomy/i18n_taxonomy.info b/sites/all/modules/contrib/localisation/i18n/i18n_taxonomy/i18n_taxonomy.info
index 59a0ca03..fd5113e2 100644
--- a/sites/all/modules/contrib/localisation/i18n/i18n_taxonomy/i18n_taxonomy.info
+++ b/sites/all/modules/contrib/localisation/i18n/i18n_taxonomy/i18n_taxonomy.info
@@ -11,9 +11,8 @@ files[] = i18n_taxonomy.pages.inc
files[] = i18n_taxonomy.admin.inc
files[] = i18n_taxonomy.test
-; Information added by Drupal.org packaging script on 2017-01-31
-version = "7.x-1.15"
+; Information added by Drupal.org packaging script on 2020-06-17
+version = "7.x-1.27"
core = "7.x"
project = "i18n"
-datestamp = "1485834792"
-
+datestamp = "1592373390"
diff --git a/sites/all/modules/contrib/localisation/i18n/i18n_taxonomy/i18n_taxonomy.module b/sites/all/modules/contrib/localisation/i18n/i18n_taxonomy/i18n_taxonomy.module
index d4d86f6e..fd2fe58c 100644
--- a/sites/all/modules/contrib/localisation/i18n/i18n_taxonomy/i18n_taxonomy.module
+++ b/sites/all/modules/contrib/localisation/i18n/i18n_taxonomy/i18n_taxonomy.module
@@ -377,10 +377,19 @@ function i18n_taxonomy_field_prepare_translation($entity_type, $entity, $field,
* The array of valid terms for this field, keyed by term id.
*/
function i18n_taxonomy_allowed_values($field) {
+ global $language;
$options = array();
foreach ($field['settings']['allowed_values'] as $tree) {
if ($vocabulary = taxonomy_vocabulary_machine_name_load($tree['vocabulary'])) {
- if ($terms = taxonomy_get_tree($vocabulary->vid, $tree['parent'])) {
+ if (i18n_taxonomy_vocabulary_mode($vocabulary->vid) == I18N_MODE_TRANSLATE) {
+ $parent = i18n_taxonomy_translation_term_tid($tree['parent'], NULL, $tree['parent']);
+ $language = i18n_language_context();
+ $terms = i18n_taxonomy_get_tree($vocabulary->vid, $language->language, $parent);
+ }
+ else {
+ $terms = taxonomy_get_tree($vocabulary->vid, $tree['parent']);
+ }
+ if ($terms) {
foreach ($terms as $term) {
$options[$term->tid] = str_repeat('-', $term->depth) . i18n_taxonomy_term_name($term);
}
@@ -747,6 +756,28 @@ function i18n_taxonomy_form_taxonomy_form_term_alter(&$form, &$form_state) {
// Add language field or not depending on taxonomy mode.
switch (i18n_taxonomy_vocabulary_mode($vocabulary->vid)) {
case I18N_MODE_TRANSLATE:
+ // Set $form_state['storage'] default as empty array because we will add
+ // the translation and target from $_GET. So we still have it when the
+ // page partially reloads with ajax.
+ if(!isset($form_state['storage'])) {
+ $form_state['storage'] = array();
+ }
+ // get translation from $_GET or $form_state['storage']
+ $translation = null;
+ if(isset($_GET['translation'])) {
+ $translation = $_GET['translation'];
+ $form_state['storage']['translation'] = $translation;
+ } else if(isset($form_state['storage']) && isset($form_state['storage']['translation'])){
+ $translation = $form_state['storage']['translation'];
+ }
+ // get target from $_GET or $form_state['storage']
+ $target = null;
+ if(isset($_GET['target'])) {
+ $target = $_GET['target'];
+ $form_state['storage']['target'] = $target;
+ } else if(isset($form_state['storage']) && isset($form_state['storage']['target'])){
+ $target = $form_state['storage']['target'];
+ }
$form['language'] = array(
'#description' => t('This term belongs to a multilingual vocabulary. You can set a language for it.'),
) + i18n_element_language_select($term);
@@ -754,7 +785,7 @@ function i18n_taxonomy_form_taxonomy_form_term_alter(&$form, &$form_state) {
// If the term to be added will be a translation of a source term,
// set the default value of the option list to the target language and
// create a form element for storing the translation set of the source term.
- if (empty($term->tid) && isset($_GET['translation']) && isset($_GET['target']) && ($source_term = taxonomy_term_load($_GET['translation'])) && ($target_language = i18n_language_object($_GET['target']))) {
+ if (empty($term->tid) && isset($translation) && isset($target) && ($source_term = taxonomy_term_load($translation)) && ($target_language = i18n_language_object($target))) {
// Set context language to target language.
i18n_language_context($target_language);
@@ -996,7 +1027,7 @@ function i18n_taxonomy_translate_terms($taxonomy, $langcode, $fullterms = TRUE)
}
elseif ($term->language && $term->language != $langcode) {
$translation_set = i18n_translation_set_load($term->i18n_tsid);
- $translations = $translation_set->get_translations();
+ $translations = ($translation_set) ? $translation_set->get_translations() : NULL;
if ($translations && !empty($translations[$langcode])) {
$newterm = $translations[$langcode];
@@ -1225,6 +1256,11 @@ function i18n_taxonomy_field_uuid_presave($entity_type, $entity, $field, $instan
* Implements hook_entity_info_alter().
*/
function i18n_taxonomy_entity_info_alter(&$entity_info) {
+ if (isset($entity_info['taxonomy_vocabulary'])) {
+ // Add altered vocabulary schema fields.
+ $entity_info['taxonomy_vocabulary']['schema_fields_sql']['base table'][] = 'i18n_mode';
+ $entity_info['taxonomy_vocabulary']['schema_fields_sql']['base table'][] = 'language';
+ }
if (isset($entity_info['taxonomy_term'])) {
// Core doesn't provide a label callback for taxonomy terms. By setting one
// we can use it to return the correct localized term name.
@@ -1275,7 +1311,7 @@ function i18n_taxonomy_modules_enabled($modules) {
* Implements hook_views_pre_render().
*/
function i18n_taxonomy_views_pre_render(&$view) {
- if(!module_exists('rules_scheduler')) {
+ if($view->base_table !== 'rules_scheduler') {
global $language;
foreach ($view->result as $delta => $term){
diff --git a/sites/all/modules/contrib/localisation/i18n/i18n_taxonomy/i18n_taxonomy.tokens.inc b/sites/all/modules/contrib/localisation/i18n/i18n_taxonomy/i18n_taxonomy.tokens.inc
index a9a753ac..47289e2a 100644
--- a/sites/all/modules/contrib/localisation/i18n/i18n_taxonomy/i18n_taxonomy.tokens.inc
+++ b/sites/all/modules/contrib/localisation/i18n/i18n_taxonomy/i18n_taxonomy.tokens.inc
@@ -15,6 +15,10 @@ function i18n_taxonomy_token_info() {
'name' => t("Name (localized)"),
'description' => t("The name of the taxonomy term."),
);
+ $term['localized-name'] = array(
+ 'name' => t("Name in current language"),
+ 'description' => t("The name of the taxonomy term in current language."),
+ );
$term['i18n-description'] = array(
'name' => t("Description (localized)"),
'description' => t("The optional description of the taxonomy term."),
@@ -69,6 +73,12 @@ function i18n_taxonomy_tokens($type, $tokens, array $data = array(), array $opti
$replacements[$original] = $sanitize ? check_plain($name) : $name;
break;
+ case 'localized-name':
+ $translated_term = i18n_taxonomy_term_get_translation($term, $langcode);
+ $name = i18n_taxonomy_term_name($translated_term, $langcode);
+ $replacements[$original] = $sanitize ? check_plain($name) : $name;
+ break;
+
case 'i18n-description':
$replacements[$original] = i18n_string_text(array('taxonomy', 'term', $term->tid, 'description'), $term->description, array('langcode' => $langcode, 'format' => $term->format, 'sanitize' => $sanitize, 'cache' => TRUE));
break;
diff --git a/sites/all/modules/contrib/localisation/i18n/i18n_translation/i18n_translation.info b/sites/all/modules/contrib/localisation/i18n/i18n_translation/i18n_translation.info
index e2fcc56a..b903330b 100644
--- a/sites/all/modules/contrib/localisation/i18n/i18n_translation/i18n_translation.info
+++ b/sites/all/modules/contrib/localisation/i18n/i18n_translation/i18n_translation.info
@@ -6,9 +6,8 @@ core = 7.x
files[] = i18n_translation.inc
-; Information added by Drupal.org packaging script on 2017-01-31
-version = "7.x-1.15"
+; Information added by Drupal.org packaging script on 2020-06-17
+version = "7.x-1.27"
core = "7.x"
project = "i18n"
-datestamp = "1485834792"
-
+datestamp = "1592373390"
diff --git a/sites/all/modules/contrib/localisation/i18n/i18n_translation/i18n_translation.module b/sites/all/modules/contrib/localisation/i18n/i18n_translation/i18n_translation.module
index de4aad4e..3fa78c8d 100644
--- a/sites/all/modules/contrib/localisation/i18n/i18n_translation/i18n_translation.module
+++ b/sites/all/modules/contrib/localisation/i18n/i18n_translation/i18n_translation.module
@@ -20,7 +20,7 @@ class I18nTranslationSetController extends DrupalDefaultEntityController {
* @param $queried_entities
* Associative array of query results, keyed on the entity ID.
* @param $revision_id
- * ID of the revision that was loaded, or FALSE if teh most current revision
+ * ID of the revision that was loaded, or FALSE if the most current revision
* was loaded.
*/
protected function attachLoad(&$queried_entities, $revision_id = FALSE) {
diff --git a/sites/all/modules/contrib/localisation/i18n/i18n_user/README.txt b/sites/all/modules/contrib/localisation/i18n/i18n_user/README.txt
index 67eedcc1..74122d39 100644
--- a/sites/all/modules/contrib/localisation/i18n/i18n_user/README.txt
+++ b/sites/all/modules/contrib/localisation/i18n/i18n_user/README.txt
@@ -12,45 +12,52 @@ CONTENTS OF THIS FILE
INTRODUCTION
------------
-The User mail translation module, part of the Internationalization (https://www.drupal.org/project/i18n) package, translates emails sent from the User module.
+The User mail translation module, part of the Internationalization
+(https://www.drupal.org/project/i18n) package, translates emails sent from the
+User module.
* For a full description of the module, visit this page:
-https://www.drupal.org/node/133977
+ https://www.drupal.org/node/133977.
* To submit bug reports and feature suggestions, or to track changes:
-https://www.drupal.org/project/issues/i18n
+ https://www.drupal.org/project/issues/i18n.
REQUIREMENTS
------------
-This module requires the following modules:
+This module requires the following module:
-Internationalization (https://www.drupal.org/project/i18n)
+* Internationalization - https://www.drupal.org/project/i18n
RECOMMENDED MODULES
-------------------
-* Internationalization Views (https://www.drupal.org/project/i18nviews)
-* Language Icons (https://www.drupal.org/project/languageicons)
-* Translation Overview (https://www.drupal.org/project/translation_overview)
-* Localization Client (https://www.drupal.org/project/l10n_client)
-* Internationalization contributions (https://www.drupal.org/project/i18n_contrib)
+* Internationalization Views - https://www.drupal.org/project/i18nviews
+* Language Icons - https://www.drupal.org/project/languageicons
+* Translation Overview - https://www.drupal.org/project/translation_overview
+* Localization Client - https://www.drupal.org/project/l10n_client
+* Internationalization contributions -
+ https://www.drupal.org/project/i18n_contrib
INSTALLATION
------------
-* This is a submodule of the Internationalization module. Install the Internationalization module as you would normally install a contributed Drupal module. Visit https://www.drupal.org/docs/7/extending-drupal-7/installing-contributed-modules-find-import-enable-configure-drupal-7 for further information.
+This is a submodule of the Internationalization module. Install the
+Internationalization module as you would normally install a contributed Drupal
+module. Visit https://www.drupal.org/node/895232 for further information.
CONFIGURATION
-------------
To configure email translations
-1. Navigate to Administration > Configuration > Regional and language > Multilingual settings and select the variables tab.
-2. Select the "User emails" tab. Select the variables you would like translated and Save configuration.
+1. Navigate to Administration > Configuration > Regional and language >
+ Multilingual settings and select the variables tab.
+2. Select the "User emails" tab. Select the variables to be translated. Save
+ configuration.
MAINTAINERS
diff --git a/sites/all/modules/contrib/localisation/i18n/i18n_user/i18n_user.info b/sites/all/modules/contrib/localisation/i18n/i18n_user/i18n_user.info
index a5051f18..b6c8fc01 100644
--- a/sites/all/modules/contrib/localisation/i18n/i18n_user/i18n_user.info
+++ b/sites/all/modules/contrib/localisation/i18n/i18n_user/i18n_user.info
@@ -4,9 +4,8 @@ core = 7.x
package = Multilingual - Internationalization
dependencies[] = i18n_variable
-; Information added by Drupal.org packaging script on 2017-01-31
-version = "7.x-1.15"
+; Information added by Drupal.org packaging script on 2020-06-17
+version = "7.x-1.27"
core = "7.x"
project = "i18n"
-datestamp = "1485834792"
-
+datestamp = "1592373390"
diff --git a/sites/all/modules/contrib/localisation/i18n/i18n_user/i18n_user.module b/sites/all/modules/contrib/localisation/i18n/i18n_user/i18n_user.module
index bd7d5dda..db9ef3aa 100644
--- a/sites/all/modules/contrib/localisation/i18n/i18n_user/i18n_user.module
+++ b/sites/all/modules/contrib/localisation/i18n/i18n_user/i18n_user.module
@@ -9,6 +9,13 @@
*/
function i18n_user_mail_alter(&$message) {
if ($message['module'] == 'user') {
+ $message['language'] = language_default();
+ if (isset($message['params']['account'])) {
+ $user_preferred = user_preferred_language($message['params']['account']);
+ if (isset($user_preferred)) {
+ $message['language'] = $user_preferred;
+ }
+ }
$language = (isset($message['language']) ? $message['language'] : language_default());
$variables = array('user' => $message['params']['account']);
$key = $message['key'];
diff --git a/sites/all/modules/contrib/localisation/i18n/i18n_variable/README.txt b/sites/all/modules/contrib/localisation/i18n/i18n_variable/README.txt
index 39e0f2bb..6831976a 100644
--- a/sites/all/modules/contrib/localisation/i18n/i18n_variable/README.txt
+++ b/sites/all/modules/contrib/localisation/i18n/i18n_variable/README.txt
@@ -8,14 +8,21 @@ CONTENTS OF THIS FILE
* Configuration
* Maintainers
+
INTRODUCTION
------------
-The Variable translation module, part of the Internationalization (https://www.drupal.org/project/i18n) package, allows the user to translate text and settings that are stored in Drupal as variables. These variables include text such as 'site name' and 'site slogan', as well as settings like 'Default front page' and 'Default 404 page'.
+The Variable translation module, part of the Internationalization
+(https://www.drupal.org/project/i18n) package, allows the user to translate text
+and settings that are stored in Drupal as variables. These variables include
+text such as 'site name' and 'site slogan', as well as settings like 'Default
+front page' and 'Default 404 page'.
-* For a full description of the module, visit https://www.drupal.org/node/1113374
+* For a full description of the module, visit:
+ https://www.drupal.org/node/1113374.
-* To submit bug reports and feature suggestions, or to track changes visit https://www.drupal.org/project/issues/i18n
+* To submit bug reports and feature suggestions, or to track changes visit:
+ https://www.drupal.org/project/issues/i18n.
REQUIREMENTS
@@ -23,24 +30,27 @@ REQUIREMENTS
This module requires the following modules:
-* Internationalization (https://www.drupal.org/project/i18n)
-* Variable (https://www.drupal.org/project/variable)
+* Internationalization - https://www.drupal.org/project/i18n
+* Variable - https://www.drupal.org/project/variable
RECOMMENDED MODULES
-------------------
-* Internationalization Views (https://www.drupal.org/project/i18nviews)
-* Language Icons (https://www.drupal.org/project/languageicons)
-* Translation Overview (https://www.drupal.org/project/translation_overview)
-* Localization Client (https://www.drupal.org/project/l10n_client)
-* Internationalization contributions (https://www.drupal.org/project/i18n_contrib)
+* Internationalization Views - https://www.drupal.org/project/i18nviews
+* Language Icons - https://www.drupal.org/project/languageicons
+* Translation Overview - https://www.drupal.org/project/translation_overview
+* Localization Client - https://www.drupal.org/project/l10n_client
+* Internationalization contributions -
+ https://www.drupal.org/project/i18n_contrib
INSTALLATION
------------
-* This is a submodule of the Internationalization module. Install the Internationalization module as you would normally install a contributed Drupal module. See https://www.drupal.org/docs/7/extending-drupal-7/installing-contributed-modules-find-import-enable-configure-drupal-7 for further information.
+This is a submodule of the Internationalization module. Install the
+Internationalization module as you would normally install a contributed Drupal
+module. Visit https://www.drupal.org/node/895232 for further information.
CONFIGURATION
@@ -48,13 +58,20 @@ CONFIGURATION
To enable multilingual variables
-1. Enable the Variable translation module included with the Internationalization package.
-2. Go to Administration > Configuration > Regional and language > Multilingual settings.
-3. Click on the Variables tab.
+1. Enable the Variable translation module included with the Internationalization
+ package.
+2. Go to Administration > Configuration > Regional and language > Multilingual
+ settings.
+3. Select on the Variables tab.
4. Select the variables that will be multilingual.
-5. Click Save configuration button.
+5. Save configuration.
-Once you have the correct settings, they'll be marked with "This is a multilingual variable" when you go to the corresponding administration pages. You must switch the site language while in the administration pages to set the variables for each language. A language switcher link will appear at the top of each administrative page that has multilingual variables.
+Once the user has the correct settings, they'll be marked with "This is a
+multilingual variable" when the user navigates to the corresponding
+administration pages. The user must switch the site language while in the
+administration pages to set the variables for each language. A language switcher
+link will appear at the top of each administrative page that has multilingual
+variables.
MAINTAINERS
diff --git a/sites/all/modules/contrib/localisation/i18n/i18n_variable/i18n_variable.info b/sites/all/modules/contrib/localisation/i18n/i18n_variable/i18n_variable.info
index 16f79a32..517b843e 100644
--- a/sites/all/modules/contrib/localisation/i18n/i18n_variable/i18n_variable.info
+++ b/sites/all/modules/contrib/localisation/i18n/i18n_variable/i18n_variable.info
@@ -10,9 +10,8 @@ configure = admin/config/regional/i18n/variable
files[] = i18n_variable.class.inc
files[] = i18n_variable.test
-; Information added by Drupal.org packaging script on 2017-01-31
-version = "7.x-1.15"
+; Information added by Drupal.org packaging script on 2020-06-17
+version = "7.x-1.27"
core = "7.x"
project = "i18n"
-datestamp = "1485834792"
-
+datestamp = "1592373390"
diff --git a/sites/all/modules/contrib/localisation/i18n/tests/i18n_test.info b/sites/all/modules/contrib/localisation/i18n/tests/i18n_test.info
index 7aaba8ce..e196b5c1 100644
--- a/sites/all/modules/contrib/localisation/i18n/tests/i18n_test.info
+++ b/sites/all/modules/contrib/localisation/i18n/tests/i18n_test.info
@@ -7,9 +7,8 @@ package = Testing
core = 6.x
hidden = TRUE
-; Information added by Drupal.org packaging script on 2017-01-31
-version = "7.x-1.15"
+; Information added by Drupal.org packaging script on 2020-06-17
+version = "7.x-1.27"
core = "7.x"
project = "i18n"
-datestamp = "1485834792"
-
+datestamp = "1592373390"
diff --git a/sites/all/modules/contrib/localisation/i18n/tests/i18n_test.module b/sites/all/modules/contrib/localisation/i18n/tests/i18n_test.module
index 0d72729a..ba5e1013 100644
--- a/sites/all/modules/contrib/localisation/i18n/tests/i18n_test.module
+++ b/sites/all/modules/contrib/localisation/i18n/tests/i18n_test.module
@@ -40,7 +40,7 @@ function i18n_test_i18n_string_info() {
'title' => t('Test Cached Strings'),
'description' => t('Translatable items of a textgroup with caching enabled.'),
'format' => FALSE, // This group doesn't have strings with format
- 'class' => 'i18n_string_textgroup_cached_logged',
+ 'class' => variable_get('i18n_string_textgroup_class_test_cached', 'i18n_string_textgroup_cached_logged'),
);
return $groups;
}
diff --git a/sites/all/modules/contrib/localisation/l10n_update/l10n_update.admin.inc b/sites/all/modules/contrib/localisation/l10n_update/l10n_update.admin.inc
index f196478a..845621e0 100644
--- a/sites/all/modules/contrib/localisation/l10n_update/l10n_update.admin.inc
+++ b/sites/all/modules/contrib/localisation/l10n_update/l10n_update.admin.inc
@@ -202,7 +202,11 @@ function l10n_update_admin_settings_form($form, &$form_state) {
'#default_value' => variable_get('l10n_update_download_store', ''),
'#description' => t('A path relative to the Drupal installation directory where translation files will be stored, e.g. sites/all/translations. Saved translation files can be reused by other installations. If left empty the downloaded translation will not be saved.'),
);
- return system_settings_form($form);
+
+ $form = system_settings_form($form);
+ $form['#submit'][] = 'l10n_update_admin_settings_form_submit';
+
+ return $form;
}
/**
@@ -220,6 +224,14 @@ function l10n_update_admin_settings_form_validate($form, &$form_state) {
}
}
+/**
+ * Additional submit handler for update settings.
+ */
+function l10n_update_admin_settings_form_submit($form, &$form_state) {
+ // Add .htaccess file to the translations directory.
+ l10n_update_ensure_htaccess();
+}
+
/**
* Get array of import options.
*
diff --git a/sites/all/modules/contrib/localisation/l10n_update/l10n_update.info b/sites/all/modules/contrib/localisation/l10n_update/l10n_update.info
index f74cf59c..52a667e5 100644
--- a/sites/all/modules/contrib/localisation/l10n_update/l10n_update.info
+++ b/sites/all/modules/contrib/localisation/l10n_update/l10n_update.info
@@ -6,9 +6,8 @@ package = Multilingual
files[] = l10n_update.parser.inc
-; Information added by Drupal.org packaging script on 2014-11-10
-version = "7.x-1.1"
+; Information added by Drupal.org packaging script on 2019-12-16
+version = "7.x-1.4"
core = "7.x"
project = "l10n_update"
-datestamp = "1415605322"
-
+datestamp = "1576494267"
diff --git a/sites/all/modules/contrib/localisation/l10n_update/l10n_update.install b/sites/all/modules/contrib/localisation/l10n_update/l10n_update.install
index 3acfad67..ecbefdfb 100644
--- a/sites/all/modules/contrib/localisation/l10n_update/l10n_update.install
+++ b/sites/all/modules/contrib/localisation/l10n_update/l10n_update.install
@@ -15,7 +15,7 @@ function l10n_update_schema() {
'name' => array(
'description' => 'A unique short name to identify the project.',
'type' => 'varchar',
- 'length' => '50',
+ 'length' => '255',
'not null' => TRUE,
),
'project_type' => array(
@@ -68,7 +68,7 @@ function l10n_update_schema() {
'project' => array(
'description' => 'A unique short name to identify the project.',
'type' => 'varchar',
- 'length' => '50',
+ 'length' => '255',
'not null' => TRUE,
),
'language' => array(
@@ -207,6 +207,27 @@ function l10n_update_requirements($phase) {
$requirements['l10n_update']['value'] = t('Not enabled');
$requirements['l10n_update']['severity'] = REQUIREMENT_INFO;
}
+
+ // Test the contents of the .htaccess file in the translations directory.
+ $directory = variable_get('l10n_update_download_store', '');
+ if ($directory) {
+ l10n_update_ensure_htaccess();
+ $htaccess_file = $directory . '/.htaccess';
+ // Check for the string which was added to the recommended .htaccess file
+ // in the latest security update.
+ if (!file_exists($htaccess_file) || !($contents = @file_get_contents($htaccess_file)) || strpos($contents, 'Drupal_Security_Do_Not_Remove_See_SA_2013_003') === FALSE) {
+ $requirements['l10n_update_htaccess'] = array(
+ 'title' => t('Translations directory'),
+ 'value' => t('Not fully protected'),
+ 'severity' => REQUIREMENT_ERROR,
+ 'description' => t('See @url for information about the recommended .htaccess file which should be added to the %directory directory to help protect against arbitrary code execution.', array(
+ '@url' => 'http://drupal.org/SA-CORE-2013-003',
+ '%directory' => $directory
+ )),
+ );
+ }
+ }
+
return $requirements;
}
// We must always return array, the installer doesn't use module_invoke_all()
@@ -297,3 +318,36 @@ function l10n_update_update_7005() {
function l10n_update_update_7006() {
registry_rebuild();
}
+
+/**
+ * Increase the length of the {l10n_update_project}.name column.
+ */
+function l10n_update_update_7007() {
+ $schema = l10n_update_schema();
+ db_change_field('l10n_update_project', 'name', 'name', $schema['l10n_update_project']['fields']['name']);
+}
+
+/**
+ * Increase the length of the {l10n_update_file}.project column.
+ */
+function l10n_update_update_7008() {
+ $schema = l10n_update_schema();
+ db_change_field('l10n_update_file', 'project', 'project', $schema['l10n_update_file']['fields']['project']);
+}
+
+/**
+ * Remove 'headers' field from cache table.
+ */
+function l10n_update_update_7009() {
+ if (db_field_exists('cache_l10n_update', 'headers')) {
+ db_drop_field('cache_l10n_update', 'headers');
+ }
+}
+
+/**
+ * Add a .htaccess file to the translations directory.
+ */
+function l10n_update_update_7010() {
+ module_load_include('module', 'l10n_update');
+ l10n_update_ensure_htaccess();
+}
diff --git a/sites/all/modules/contrib/localisation/l10n_update/l10n_update.module b/sites/all/modules/contrib/localisation/l10n_update/l10n_update.module
index 0ec2a8ce..0027d805 100644
--- a/sites/all/modules/contrib/localisation/l10n_update/l10n_update.module
+++ b/sites/all/modules/contrib/localisation/l10n_update/l10n_update.module
@@ -494,3 +494,13 @@ function l10n_update_flush_caches() {
}
return array();
}
+
+/**
+ * Creates a .htaccess file in the translations directory if it is missing.
+ */
+function l10n_update_ensure_htaccess() {
+ $directory = variable_get('l10n_update_download_store', '');
+ if ($directory) {
+ file_create_htaccess($directory, FALSE);
+ }
+}
diff --git a/sites/all/modules/contrib/localisation/l10n_update/l10n_update.project.inc b/sites/all/modules/contrib/localisation/l10n_update/l10n_update.project.inc
index f0129703..a4642514 100644
--- a/sites/all/modules/contrib/localisation/l10n_update/l10n_update.project.inc
+++ b/sites/all/modules/contrib/localisation/l10n_update/l10n_update.project.inc
@@ -47,42 +47,18 @@ function l10n_update_build_projects($refresh = FALSE) {
$default_server = l10n_update_default_server();
- if (module_exists('update')) {
- $projects_info = update_get_available(TRUE);
- }
foreach ($projects as $name => $data) {
-
- // Force update fetch of project data in cases where Drupal's performance
- // optimized approach is missing out on some projects.
- // @see http://drupal.org/node/1671570#comment-6216090
- if (module_exists('update') && !isset($projects_info[$name])) {
- module_load_include('fetch.inc', 'update');
- _update_process_fetch_task($data);
- $available = _update_get_cached_available_releases();
- if (!empty($available[$name])) {
- $projects_info[$name] = $available[$name];
+ // For dev releases, remove the '-dev' part and trust the translation server
+ // to fall back to the latest stable release for that branch.
+ if (isset($data['info']['version']) && strpos($data['info']['version'], '-dev')) {
+ if (preg_match("/^(\d+\.x-\d+\.).*$/", $data['info']['version'], $matches)) {
+ // Example matches: 7.x-1.x-dev, 7.x-1.0-alpha1+5-dev => 7.x-1.x
+ $data['info']['version'] = $matches[1] . 'x';
}
- }
-
- if (isset($projects_info[$name]['releases']) && $projects_info[$name]['project_status'] != 'not-fetched') {
- // Find out if a dev version is installed.
- if (preg_match("/^[0-9]+\.x-([0-9]+)\..*-dev$/", $data['info']['version'], $matches)) {
- // Find a suitable release to use as alternative translation.
- foreach ($projects_info[$name]['releases'] as $project_release) {
- // The first release with the same major release number which is not
- // a dev release is the one. Releases are sorted the most recent first.
- if ($project_release['version_major'] == $matches[1] &&
- (!isset($project_release['version_extra']) || $project_release['version_extra'] != 'dev')) {
- $release = $project_release;
- break;
- }
- }
+ elseif (preg_match("/^(\d+\.).*$/", $data['info']['version'], $matches)) {
+ // Example match: 7.33-dev => 7.x (Drupal core)
+ $data['info']['version'] = $matches[1] . 'x';
}
- if (!empty($release['version'])) {
- $data['info']['version'] = $release['version'];
- }
-
- unset($release);
}
$data += array(
@@ -228,7 +204,7 @@ function _l10n_update_project_info_list(&$projects, $list, $project_type, $disab
'name' => $project_name,
'info' => $file->info,
'datestamp' => isset($file->info['datestamp']) ? $file->info['datestamp'] : 0,
- 'includes' => array($file->name => $file->info['name']),
+ 'includes' => array($file->name => isset($file->info['name']) ? $file->info['name'] : $file->name),
'project_type' => $project_name == 'drupal' ? 'core' : $project_type,
);
}