Projet

Général

Profil

Révision a45e4bc1

Ajouté par Assos Assos il y a environ 9 ans

Update webform to 4.10

Voir les différences:

drupal7/sites/all/modules/webform/views/webform_handler_field_node_link_edit.inc
10 10
 */
11 11
class webform_handler_field_node_link_edit extends views_handler_field_node_link {
12 12

  
13
  function option_definition() {
14
    $options = parent::option_definition();
15
    $options['subpath'] = array('default' => '');
16
    return $options;
17
  }
18

  
19
  function options_form(&$form, &$form_state) {
20
    parent::options_form($form, $form_state);
21
    $form['subpath'] = array(
22
      '#type' => 'textfield',
23
      '#title' => t('Subpath'),
24
      '#default_value' => $this->options['subpath'],
25
      '#field_prefix' => 'node/NID/webform/',
26
    );
27
  }
28

  
13 29
  /**
14 30
   * Renders the link.
15 31
   */
16 32
  function render_link($node, $values) {
17
    // Ensure user has access to edit this node.
18
    if (!node_access('update', $node)) {
33
    // Ensure node is webform-enabled and user has access to edit this node.
34
    if (!in_array($node->type, webform_node_types()) || !node_access('update', $node)) {
19 35
      return;
20 36
    }
21 37

  
22 38
    $this->options['alter']['make_link'] = TRUE;
23
    $this->options['alter']['path'] = "node/$node->nid/webform";
39
    $this->options['alter']['path'] = "node/$node->nid/webform" .
40
                                      (strlen($this->options['subpath']) ? '/' . $this->options['subpath'] : '');
24 41

  
25 42
    $text = !empty($this->options['text']) ? $this->options['text'] : t('edit webform');
26 43
    return $text;
27 44
  }
28 45

  
29 46
}
30

  

Formats disponibles : Unified diff