Projet

Général

Profil

Révision 01f36513

Ajouté par Assos Assos il y a environ 6 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/webform/includes/webform.conditionals.inc
664 664
 *   The rid of the found rule, or -1 if none. Note that NULL is not used as a
665 665
 *   semaphore for "not found" because it casts to 0, which is a valid rule id.
666 666
 */
667
function _webform_conditional_find_end($rules, $origin_rid, $target_delta_level = 0) {
667
function _webform_conditional_find_end(array $rules, $origin_rid, $target_delta_level = 0) {
668 668
  $rids = array_keys($rules);
669 669
  $offset = array_search($origin_rid, $rids);
670 670
  $delta_level = 0;
......
819 819
 * @return array
820 820
 *   Array of deleted subconditionals. Empty array if none were deleted.
821 821
 */
822
function webform_delete_empty_subconditionals(&$conditional) {
822
function webform_delete_empty_subconditionals(array &$conditional) {
823 823
  $deleted = array();
824 824
  do {
825 825
    $empty_deleted = FALSE;
......
901 901

  
902 902
      default:
903 903
        // Hide labels.
904
        $rule['source']['#title_display'] = 'none';
905
        $rule['operator']['#title_display'] = 'none';
906
        $rule['value']['#title_display'] = 'none';
904
        $rule['source']['#title_display'] = 'invisible';
905
        $rule['operator']['#title_display'] = 'invisible';
906
        $rule['value']['#title_display'] = 'invisible';
907 907

  
908 908
        $source = '<div class="webform-conditional-source">' . drupal_render($rule['source']) . '</div>';
909 909
        $operator = '<div class="webform-conditional-operator">' . drupal_render($rule['operator']) . '</div>';
......
926 926
    $output .= '</div>';
927 927

  
928 928
    if (isset($rule['andor'])) {
929
      $rule['andor']['#title_display'] = 'none';
929
      $rule['andor']['#title_display'] = 'invisible';
930 930
      $output .= '<div class="webform-conditional-andor webform-container-inline">';
931 931
      $output .= drupal_render($rule['andor']);
932 932
      $output .= '</div>';
......
946 946
  // Hide labels.
947 947
  foreach (element_children($element['actions']) as $aid) {
948 948
    // Hide labels.
949
    $element['actions'][$aid]['target']['#title_display'] = 'none';
950
    $element['actions'][$aid]['invert']['#title_display'] = 'none';
951
    $element['actions'][$aid]['action']['#title_display'] = 'none';
952
    $element['actions'][$aid]['argument']['#title_display'] = 'none';
949
    $element['actions'][$aid]['target']['#title_display'] = 'invisible';
950
    $element['actions'][$aid]['invert']['#title_display'] = 'invisible';
951
    $element['actions'][$aid]['action']['#title_display'] = 'invisible';
952
    $element['actions'][$aid]['argument']['#title_display'] = 'invisible';
953 953

  
954 954
    $target = '<div class="webform-conditional-target">' . drupal_render($element['actions'][$aid]['target']) . '</div>';
955 955
    $invert = '<div class="webform-conditional-invert">' . drupal_render($element['actions'][$aid]['invert']) . '</div>';
......
1273 1273
  webform_component_include('select');
1274 1274
  foreach ($node->webform['components'] as $cid => $component) {
1275 1275
    if (webform_component_property($component['type'], 'conditional_type') == 'select') {
1276
      // TODO: Use a pluggable mechanism for retrieving select list values.
1276
      // @todo: Use a pluggable mechanism for retrieving select list values.
1277 1277
      $options = _webform_select_options($component);
1278 1278
      $element = array(
1279 1279
        '#type' => 'select',
......
1299 1299
  static $count = 0;
1300 1300
  $element = array(
1301 1301
    '#title' => NULL,
1302
    '#title_display' => 'none',
1302
    '#title_display' => 'invisible',
1303 1303
    '#size' => 24,
1304 1304
    '#attributes' => array('placeholder' => t('@format or valid date', array('@format' => webform_date_format('short')))),
1305 1305
    '#type' => 'textfield',
......
1315 1315
  static $count = 0;
1316 1316
  $element = array(
1317 1317
    '#title' => NULL,
1318
    '#title_display' => 'none',
1318
    '#title_display' => 'invisible',
1319 1319
    '#size' => 24,
1320 1320
    '#attributes' => array('placeholder' => t('HH:MMam or valid time')),
1321 1321
    '#type' => 'textfield',
......
1399 1399
 * @return array
1400 1400
 *   Array of settings to be send to the browser as javascript settings.
1401 1401
 */
1402
function webform_conditional_prepare_javascript($node, $submission_data, $page_num) {
1402
function webform_conditional_prepare_javascript($node, array $submission_data, $page_num) {
1403 1403
  $settings = array(
1404 1404
    'ruleGroups' => array(),
1405 1405
    'sourceMap' => array(),
......
1747 1747
 * @param array $options
1748 1748
 *   Associative array where the $a and $b are within the keys.
1749 1749
 *
1750
 * @return integer based upon position of $a and $b in $options
1750
 * @return int|null
1751
 *   Based upon position of $a and $b in $options:
1751 1752
 *   -N if $a above (<) $b
1752 1753
 *   0 if $a = $b
1753 1754
 *   +N if $a is below (>) $b
1754 1755
 */
1755
function webform_compare_select($a, $b, $options) {
1756
function webform_compare_select($a, $b, array $options) {
1756 1757
  // Select keys that are integer-like strings are numeric indices in PHP.
1757 1758
  // Convert the array keys to an array of strings.
1758 1759
  $options_array = array_map(function ($i) {
......
1760 1761
  }, array_keys($options));
1761 1762
  $a_position = array_search($a, $options_array, TRUE);
1762 1763
  $b_position = array_search($b, $options_array, TRUE);
1763
  return ($a_position === FALSE || $a_position === FALSE) ? NULL : $a_position - $b_position;
1764

  
1764
  return ($a_position === FALSE || $b_position === FALSE) ? NULL : $a_position - $b_position;
1765 1765
}

Formats disponibles : Unified diff