You are here

function content_callback in Content Construction Kit (CCK) 6.3

Same name and namespace in other branches
  1. 6 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

5 calls to content_callback()
content_field_edit_form in includes/content.admin.inc
Menu callback; presents the field editing page.
content_field_edit_form_validate in includes/content.admin.inc
Validate a field's settings.
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_multigroup_group_form in modules/content_multigroup/content_multigroup.node_form.inc
Create a new delta value for the group.

File

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