You are here

function content_callback in Content Construction Kit (CCK) 6

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

Helper function for determining the behavior of a field or a widget with respect to a given operation. (currently used for field 'view', and widget 'default values' and 'multiple values')

Parameters

$entity: 'field' or 'widget' @param $op the name of the operation ('view', 'default value'...) @param $field The field array, including widget info. @return CONTENT_CALLBACK_NONE - do nothing for this operation CONTENT_CALLBACK_CUSTOM - use the module's callback function. CONTENT_CALLBACK_DEFAULT - use content module default behavior

4 calls to content_callback()
content_field_form in includes/content.node_form.inc
Create a separate form element for each field.
content_field_instance_expand in includes/content.crud.inc
Expand field info to create field => widget info.
_content_admin_field in includes/content.admin.inc
Menu callback; presents the field editing page.
_content_admin_field_validate in includes/content.admin.inc
Validate a field's settings.

File

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

Code

function content_callback($entity, $op, $field) {
  switch ($entity) {
    case 'field':
      $info = module_invoke($field['module'], "field_info");
      return isset($info[$field['type']]['callbacks'][$op]) ? $info[$field['type']]['callbacks'][$op] : CONTENT_CALLBACK_DEFAULT;
    case 'widget':
      $info = module_invoke($field['widget']['module'], "widget_info");
      return isset($info[$field['widget']['type']]['callbacks'][$op]) ? $info[$field['widget']['type']]['callbacks'][$op] : CONTENT_CALLBACK_DEFAULT;
  }
}