Dru Documentation

Go to front page

developer/hooks/node.php, string 68 Versions 5 - 6 hook_node_info () "Translation" the Pre-image Defines types нод which are submitiven by the unit. This хук is used by the units, having the types нод. It is necessary that units could define one or more types нод. It is called for instructions of names and аттрибутов types нод units. Тольку нод which are submitiven by the unit, it is necessary to define types by means of it хука. Types нод which form by users, should be described only in the table ' node_type ' databases and should be serviced by means of functions node_type_save () and node_type_delete (). The machine title of type ноды can contain only characters of the Latin alphabet and the sign of the lower underlining. Signs of the lower underlining will are transformed to hyphens at URL designing. All attributes of type ноды, which are set to the data хуком, (except аттрибута ' locked ') can be changed the manager of a site. If the attribute ' locked ' is installed in FALSE the machine title of type ноды also can be changed. Detailed example of usage look in node_example.module. Returned value The array with the information on types нод the given unit. Array cells are under-files which contain the data about each type нод, and a key is the machine title of types нод. Everyone under-file contains to 10 аттрибутов. Possible аттрибуты: * ' name ': a type Title нод which people can read. Mandatory аттрибут. * ' module ': String which informs Drupal as unit functions correspond with хуками. For example, if module it is defined as example_foo example_foo_insert it will be called for creation new ноыд this type. Usually this string coincides with a name of the current unit, but not always. Mandatory аттрибут. * ' description ': Short type declaration ноды. Mandatory аттрибут. * ' help ': the Text which will be shown over the creation form ноды this type. Not mandatory аттрибут (by default "). * ' has_title ': whether Boolean value defining has the given type ноды 'the field' Header '. Not mandatory аттрибут (by default TRUE). * ' title_label ': the Subscript to ' field Header ' this type of materials. Not mandatory аттрибут (by default ' Title '). * ' has_body ': whether Boolean value defining has the given type ноды 'the body field'. Not mandatory аттрибут (by default TRUE). * ' body_label ': the Subscript for ' field the Text ' (' body ') for this type of materials. Not mandatory аттрибут (by default ' Body '). * ' min_word_count ': the Minimum quantity of words, which 'the body field' of the given type ноды should contain to pass валидацию. Not mandatory аттрибут (by default 0). * ' locked ': the Given attribute should contain Boolean value, defining it is forbidden (FALSE) or it is authorised (TRUE) to the manager of a site to change a machine name of this type нод. Not mandatory аттрибут (by default TRUE). Define module-provided node types. This is a hook used by node modules. This hook is required for modules to define one or more node types. It is called to determine the names and the attributes of a module's node types. Only module-provided node types should be defined through this hook. USER - provided (or ' custom ') node types should be defined only in the ' node_type ' database table, and should be maintained by using the node_type_save () and node_type_delete () functions. The machine-readable name of a node type should contain only letters, numbers, and underscores. Underscores will be converted into hyphens for the purpose of contructing URLs. All attributes of a node type that are defined through this hook (except for ' locked ') can be edited by a site administrator. This includes the machine-readable name of a node type, if ' locked ' is set to FALSE. For a detailed usage example, see node_example.module. Return value An array of information on the module's node types. The array contains a sub-array for each node type, with the machine-readable type name as the key. Each sub-array has up to 10 attributes. Possible attributes: * "name": the human-readable name of the node type. Required. * "module": a string telling Drupal how a module's functions map to hooks (i.e. if module is defined as example_foo, then example_foo_insert will be called when inserting a node of that type). This string is usually the name of the module in question, but not always. Required. * "description": a brief description of the node type. Required. * "help": text that will be displayed at the top of the submission form for this content type. Optional (defaults to "). * "has_title": boolean indicating whether or not this node type has a title field. Optional (defaults to TRUE). * "title_label": the label for the title field of this content type. Optional (defaults to ' Title '). * "has_body": boolean indicating whether or not this node type has a body field. Optional (defaults to TRUE). * "body_label": the label for the body field of this content type. Optional (defaults to ' Body '). * "min_word_count": the minimum number of words for the body field to be considered valid for this content type. Optional (defaults to 0). * "locked": boolean indicating whether the machine-readable name of this content type can (FALSE) or cannot (TRUE) be edited by a site administrator. Optional (defaults to TRUE). The linked subjects Хуки Allows units to co-operate with kernel Drupal. ? 2 functions call hook_node_info ()