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/flag.api.php
58 58
 */
59 59
function hook_flag_default_flags() {
60 60
  $flags = array();
61
  $flags['bookmarks'] = array (
61
  $flags['bookmarks'] = array(
62 62
    'entity_type' => 'node',
63 63
    'title' => 'Bookmarks',
64 64
    'global' => FALSE,
65
    'types' => array (
65
    'types' => array(
66 66
      0 => 'article',
67 67
      1 => 'blog',
68 68
    ),
......
75 75
    'unflag_denied_text' => '',
76 76
    'link_type' => 'toggle',
77 77
    'weight' => 0,
78
    'show_in_links' => array (
78
    'show_in_links' => array(
79 79
      'full' => TRUE,
80 80
      'token' => FALSE,
81 81
    ),
......
90 90
  return $flags;
91 91
}
92 92

  
93
/**
94
 * Alter the definition of default flags.
95
 *
96
 * @param array &$flags
97
 *   An array keyed by flag machine name containing flag definitions.
98
 */
99
function hook_flag_default_flags_alter(&$flags) {
100
  if (!empty($flags['bookmark'])) {
101
    $flags['bookmark']['title'] = 'Bananana Bookmark';
102
  }
103
}
104

  
93 105
/**
94 106
 * Allow modules to alter a flag when it is initially loaded.
95 107
 *
96
 * @see flag_get_flags().
108
 * @see flag_get_flags()
97 109
 */
98 110
function hook_flag_alter(&$flag) {
99 111

  
......
183 195
      $count = count($flags[$flag->name]);
184 196
      if ($count >= 2) {
185 197
        // Users may flag only 2 nodes with this flag.
186
        return(array('access-denied' => t('You may only flag 2 nodes with the test flag.')));
198
        return (array('access-denied' => t('You may only flag 2 nodes with the test flag.')));
187 199
      }
188 200
    }
189 201
  }

Formats disponibles : Unified diff