Projet

Général

Profil

Révision 76e2e7c3

Ajouté par Assos Assos il y a environ 10 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/flag/includes/flag.pages.inc
93 93

  
94 94
  $question = $flag->get_label($action . '_confirmation', $entity_id);
95 95
  $path = isset($_GET['destination']) ? $_GET['destination'] : '<front>';
96
  $yes = $flag->get_label($action . '_short', $entity_id);
96
  $yes = strip_tags($flag->get_label($action . '_short', $entity_id));
97 97

  
98 98
  if ($action == 'flag') {
99 99
    // If the action 'flag', we're potentially about to create a new
......
101 101
    $flagging = $flag->new_flagging($entity_id);
102 102
    field_attach_form('flagging', $flagging, $form, $form_state);
103 103
    $form['#flagging'] = $flagging;
104

  
105
    // Take the same approach as Core entity forms: shove all the entity
106
    // properties into the form as values so that entity_form_field_validate()
107
    // can build a pseudoentity from $form_values in the validate handler.
108
    foreach (array(
109
      'flag_name',
110
      'entity_type',
111
      'entity_id',
112
      'uid',
113
    ) as $key) {
114
      $form[$key] = array(
115
        '#type' => 'value',
116
        '#value' => isset($flagging->$key) ? $flagging->$key : NULL,
117
      );
118
    }
104 119
  }
105 120

  
106 121
  return confirm_form($form, $question, $path, '', $yes);
107 122
}
108 123

  
124
/**
125
 * Validate handler for the flag confirm form.
126
 *
127
 * Validate any Field API fields on the Flagging.
128
 *
129
 * @see flag_confirm()
130
 */
131
function flag_confirm_validate($form, &$form_state) {
132
  // Only validate the entity fields when we're saving an entity.
133
  $action = $form_state['values']['action'];
134
  if ($action == 'flag') {
135
    entity_form_field_validate('flagging', $form, $form_state);
136
  }
137
}
138

  
109 139
/**
110 140
 * Submit handler for the flag confirm form.
111 141
 *

Formats disponibles : Unified diff