You are here

function content_handle in Content Construction Kit (CCK) 6

Same name and namespace in other branches
  1. 5 content.module \content_handle()
  2. 6.3 content.module \content_handle()
  3. 6.2 content.module \content_handle()

Helper function for determining the handling of a field, widget or formatter with respect to a given operation.

Currently used for widgets and formatters 'multiple values'.

Parameters

$entity: 'field', 'widget' or 'formatter' @param $op the name of the operation ('default values'...) @param $object

  • if $entity is 'field' or 'widget' : the field array, including widget info.
  • if $entity is 'formater' : the formatter array.

@return CONTENT_HANDLE_CORE - the content module handles this operation. CONTENT_HANDLE_MODULE - the implementing module handles this operation.

3 calls to content_handle()
content_field in ./content.module
Implementation of hook_field(). Handles common field housekeeping.
content_field_form in includes/content.node_form.inc
Create a separate form element for each field.
content_format in ./content.module
Format a field item for display.

File

./content.module, line 1756
Allows administrators to associate custom fields to content types.

Code

function content_handle($entity, $op, $object) {
  switch ($entity) {
    case 'field':
      $info = module_invoke($object['module'], "field_info");
      return isset($info[$object['type']][$op]) ? $info[$object['type']][$op] : CONTENT_HANDLE_CORE;
    case 'widget':
      $info = module_invoke($object['widget']['module'], "widget_info");
      return isset($info[$object['widget']['type']][$op]) ? $info[$object['widget']['type']][$op] : CONTENT_HANDLE_CORE;
    case 'formatter':

      // Much simpler, formatters arrays *are* the 'formatter_info' itself.
      // We let content_handle deal with them only for code consistency.
      return isset($object[$op]) ? $object[$op] : CONTENT_HANDLE_CORE;
  }
}