You are here

function content_handle in Content Construction Kit (CCK) 5

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

Helper function for determining the behaviour of a field or a widget with respect to a given operation (currently only used for 'view' field op and 'default value' widegt op)

Parameters

$entity: 'field' or 'widget'

@param $op the name of the operation ('view', 'validate'...)

@param $field The field array, including widget info.

Return value

CONTENT_CALLBACK_NONE - do nothing for this operation CONTENT_CALLBACK_CUSTOM - use the module's callback function. CONTENT_CALLBACK_DEFAULT - use content module default behaviour

6 calls to content_handle()
content_default_value in ./content.module
Helper function to return the correct default value for a field.
content_panels_render_field in ./content_panels.inc
_content_admin_field in ./content_admin.inc
Menu callback; presents the field editing page.
_content_admin_field_submit in ./content_admin.inc
Save a field's settings after editing.
_content_admin_field_validate in ./content_admin.inc
Validate a field's settings.

... See full list

File

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

Code

function content_handle($entity, $op, $field) {
  $entity_types = $entity == 'field' ? _content_field_types() : _content_widget_types();
  $entity_type = $entity == 'field' ? $field['type'] : $field['widget']['type'];
  $module = $entity_types[$entity_type]['module'];
  if ($op == 'default value' && $module == 'computed_field') {
    $callback_value = CONTENT_CALLBACK_NONE;
  }
  else {
    $callbacks = module_invoke($module, "{$entity}_settings", 'callbacks', $field);
    $callback_value = isset($callbacks[$op]) ? $callbacks[$op] : CONTENT_CALLBACK_DEFAULT;
  }
  return $callback_value;
}