You are here

function content_handle in Content Construction Kit (CCK) 6.3

Same name and namespace in other branches
  1. 5 content.module \content_handle()
  2. 6 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.

9 calls to content_handle()
content_field in ./content.module
Implementation of hook_field(). Handles common field housekeeping.
content_field_edit_form in includes/content.admin.inc
Menu callback; presents the field editing page.
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.
content_generate_fields in includes/content.devel.inc
Enrich the $node that is about to be saved with arbitrary information in each of its CCK fields.

... See full list

File

./content.module, line 2251
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;
  }
}