Projet

Général

Profil

Révision 99781f3b

Ajouté par Assos Assos il y a plus de 7 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/token/token.module
274 274
 */
275 275
function token_field_widget_form_alter(&$element, &$form_state, $context) {
276 276
  if (!empty($element['#description']) && !empty($context['instance']['description'])) {
277
    $element['#description'] = filter_xss_admin(token_replace($context['instance']['description']));
277
    $instance = $context['instance'];
278
    if (module_exists('i18n_field')) {
279
      $instance = i18n_string_object_translate('field_instance', $instance);
280
    }
281
    $element['#description'] = field_filter_xss(token_replace($instance['description']));
278 282
  }
279 283
}
280 284

  
......
719 723

  
720 724
  // Validate if an element must have a minimum number of tokens.
721 725
  if (isset($element['#min_tokens']) && count($tokens) < $element['#min_tokens']) {
722
    // @todo Change this error message to include the minimum number.
723
    $error = format_plural($element['#min_tokens'], 'The %element-title cannot contain fewer than one token.', 'The %element-title must contain at least @count tokens.', array('%element-title' => $title));
726
    $error = format_plural($element['#min_tokens'], '%name must contain at least one token.', '%name must contain at least @count tokens.', array('%name' => $title));
724 727
    form_error($element, $error);
725 728
  }
726 729

  
727 730
  // Validate if an element must have a maximum number of tokens.
728 731
  if (isset($element['#max_tokens']) && count($tokens) > $element['#max_tokens']) {
729
    // @todo Change this error message to include the maximum number.
730
    $error = format_plural($element['#max_tokens'], 'The %element-title must contain as most one token.', 'The %element-title must contain at most @count tokens.', array('%element-title' => $title));
732
    $error = format_plural($element['#max_tokens'], '%name must contain at most one token.', '%name must contain at most @count tokens.', array('%name' => $title));
731 733
    form_error($element, $error);
732 734
  }
733 735

  
......
735 737
  if (isset($element['#token_types'])) {
736 738
    $invalid_tokens = token_get_invalid_tokens_by_context($tokens, $element['#token_types']);
737 739
    if ($invalid_tokens) {
738
      form_error($element, t('The %element-title is using the following invalid tokens: @invalid-tokens.', array('%element-title' => $title, '@invalid-tokens' => implode(', ', $invalid_tokens))));
740
      form_error($element, t('%name is using the following invalid tokens: @invalid-tokens.', array('%name' => $title, '@invalid-tokens' => implode(', ', $invalid_tokens))));
739 741
    }
740 742
  }
741 743

  
......
983 985
      // parent.
984 986
      $token_parents[] = $token_type;
985 987
    }
986
    elseif (in_array($token, array_slice($token_parents, 1))) {
988
    elseif (in_array($token, array_slice($token_parents, 1), TRUE)) {
987 989
      // Prevent duplicate recursive tokens. For example, this will prevent
988 990
      // the tree from generating the following tokens or deeper:
989 991
      // [comment:parent:parent]

Formats disponibles : Unified diff