Projet

Général

Profil

Révision b4adf10d

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

Udpate to 7.33

Voir les différences:

drupal7/modules/node/node.api.php
17 17
 * During node operations (create, update, view, delete, etc.), there are
18 18
 * several sets of hooks that get invoked to allow modules to modify the base
19 19
 * node operation:
20
 * - Node-type-specific hooks: These hooks are only invoked on the primary
21
 *   module, using the "base" return component of hook_node_info() as the
22
 *   function prefix.  For example, poll.module defines the base for the Poll
23
 *   content type as "poll", so during creation of a poll node, hook_insert() is
24
 *   only invoked by calling poll_insert().
20
 * - Node-type-specific hooks: When defining a node type, hook_node_info()
21
 *   returns a 'base' component. Node-type-specific hooks are named
22
 *   base_hookname() instead of mymodule_hookname() (in a module called
23
 *   'mymodule' for example). Only the node type's corresponding implementation
24
 *   is invoked. For example, poll_node_info() in poll.module defines the base
25
 *   for the 'poll' node type as 'poll'. So when a poll node is created,
26
 *   hook_insert() is invoked on poll_insert() only.
27
 *   Hooks that are node-type-specific are noted below.
25 28
 * - All-module hooks: This set of hooks is invoked on all implementing modules,
26 29
 *   to allow other modules to modify what the primary node module is doing. For
27 30
 *   example, hook_node_insert() is invoked on all modules when creating a poll
......
195 198
  if (user_access('access private content', $account)) {
196 199
    $grants['example'] = array(1);
197 200
  }
198
  $grants['example_owner'] = array($account->uid);
201
  $grants['example_author'] = array($account->uid);
199 202
  return $grants;
200 203
}
201 204

  
......
885 888
 *   name as the key. Each sub-array has up to 10 attributes. Possible
886 889
 *   attributes:
887 890
 *   - name: (required) The human-readable name of the node type.
888
 *   - base: (required) The base string used to construct callbacks
889
 *     corresponding to this node type (for example, if base is defined as
890
 *     example_foo, then example_foo_insert will be called when inserting a node
891
 *     of that type). This string is usually the name of the module, but not
892
 *     always.
891
 *   - base: (required) The base name for implementations of node-type-specific
892
 *     hooks that respond to this node type. Base is usually the name of the
893
 *     module or 'node_content', but not always. See
894
 *     @link node_api_hooks Node API hooks @endlink for more information.
893 895
 *   - description: (required) A brief description of the node type.
894 896
 *   - help: (optional) Help information shown to the user when creating a node
895 897
 *     of this type.
......
1030 1032
/**
1031 1033
 * Respond to node deletion.
1032 1034
 *
1033
 * This hook is invoked only on the module that defines the node's content type
1034
 * (use hook_node_delete() to respond to all node deletions).
1035
 * This is a node-type-specific hook, which is invoked only for the node type
1036
 * being affected. See
1037
 * @link node_api_hooks Node API hooks @endlink for more information.
1038
 *
1039
 * Use hook_node_delete() to respond to node deletion of all node types.
1035 1040
 *
1036 1041
 * This hook is invoked from node_delete_multiple() before hook_node_delete()
1037 1042
 * is invoked and before field_attach_delete() is called.
......
1059 1064
/**
1060 1065
 * Act on a node object about to be shown on the add/edit form.
1061 1066
 *
1062
 * This hook is invoked only on the module that defines the node's content type
1063
 * (use hook_node_prepare() to act on all node preparations).
1067
 * This is a node-type-specific hook, which is invoked only for the node type
1068
 * being affected. See
1069
 * @link node_api_hooks Node API hooks @endlink for more information.
1070
 *
1071
 * Use hook_node_prepare() to respond to node preparation of all node types.
1064 1072
 *
1065 1073
 * This hook is invoked from node_object_prepare() before the general
1066 1074
 * hook_node_prepare() is invoked.
......
1089 1097
/**
1090 1098
 * Display a node editing form.
1091 1099
 *
1100
 * This is a node-type-specific hook, which is invoked only for the node type
1101
 * being affected. See
1102
 * @link node_api_hooks Node API hooks @endlink for more information.
1103
 *
1104
 * Use hook_form_BASE_FORM_ID_alter(), with base form ID 'node_form', to alter
1105
 * node forms for all node types.
1106
 *
1092 1107
 * This hook, implemented by node modules, is called to retrieve the form
1093 1108
 * that is displayed to create or edit a node. This form is displayed at path
1094 1109
 * node/add/[node type] or node/[node ID]/edit.
......
1144 1159
/**
1145 1160
 * Respond to creation of a new node.
1146 1161
 *
1147
 * This hook is invoked only on the module that defines the node's content type
1148
 * (use hook_node_insert() to act on all node insertions).
1162
 * This is a node-type-specific hook, which is invoked only for the node type
1163
 * being affected. See
1164
 * @link node_api_hooks Node API hooks @endlink for more information.
1165
 *
1166
 * Use hook_node_insert() to respond to node insertion of all node types.
1149 1167
 *
1150 1168
 * This hook is invoked from node_save() after the node is inserted into the
1151 1169
 * node table in the database, before field_attach_insert() is called, and
......
1168 1186
/**
1169 1187
 * Act on nodes being loaded from the database.
1170 1188
 *
1171
 * This hook is invoked only on the module that defines the node's content type
1172
 * (use hook_node_load() to respond to all node loads).
1189
 * This is a node-type-specific hook, which is invoked only for the node type
1190
 * being affected. See
1191
 * @link node_api_hooks Node API hooks @endlink for more information.
1192
 *
1193
 * Use hook_node_load() to respond to node load of all node types.
1173 1194
 *
1174 1195
 * This hook is invoked during node loading, which is handled by entity_load(),
1175 1196
 * via classes NodeController and DrupalDefaultEntityController. After the node
......
1202 1223
/**
1203 1224
 * Respond to updates to a node.
1204 1225
 *
1205
 * This hook is invoked only on the module that defines the node's content type
1206
 * (use hook_node_update() to act on all node updates).
1226
 * This is a node-type-specific hook, which is invoked only for the node type
1227
 * being affected. See
1228
 * @link node_api_hooks Node API hooks @endlink for more information.
1229
 *
1230
 * Use hook_node_update() to respond to node update of all node types.
1207 1231
 *
1208 1232
 * This hook is invoked from node_save() after the node is updated in the
1209 1233
 * node table in the database, before field_attach_update() is called, and
......
1224 1248
/**
1225 1249
 * Perform node validation before a node is created or updated.
1226 1250
 *
1227
 * This hook is invoked only on the module that defines the node's content type
1228
 * (use hook_node_validate() to act on all node validations).
1251
 * This is a node-type-specific hook, which is invoked only for the node type
1252
 * being affected. See
1253
 * @link node_api_hooks Node API hooks @endlink for more information.
1254
 *
1255
 * Use hook_node_validate() to respond to node validation of all node types.
1229 1256
 *
1230 1257
 * This hook is invoked from node_validate(), after a user has finished
1231 1258
 * editing the node and is previewing or submitting it. It is invoked at the end
......
1258 1285
/**
1259 1286
 * Display a node.
1260 1287
 *
1261
 * This hook is invoked only on the module that defines the node's content type
1262
 * (use hook_node_view() to act on all node views).
1288
 * This is a node-type-specific hook, which is invoked only for the node type
1289
 * being affected. See
1290
 * @link node_api_hooks Node API hooks @endlink for more information.
1291
 *
1292
 * Use hook_node_view() to respond to node view of all node types.
1263 1293
 *
1264 1294
 * This hook is invoked during node viewing after the node is fully loaded, so
1265 1295
 * that the node type module can define a custom method for display, or add to

Formats disponibles : Unified diff