You are here

function content_build_modes in Content Construction Kit (CCK) 6.3

Same name and namespace in other branches
  1. 6.2 content.module \content_build_modes()

Registry of available node build modes.

Parameters

$selector: Determines what information should be returned.

Return value

Depending on the value of the $selector parameter:

  • NULL: a flat list of all available build modes.

The other two options are mainly used internally by CCK's UI:

  • '_tabs': the list of tabs to be shown on the 'Display fields' screens.
  • a string tab id: the build modes in this tab.
8 calls to content_build_modes()
content_display_overview_form in includes/content.admin.inc
Menu callback; presents a listing of fields display settings for a content type.
content_instance_default_values in includes/content.crud.inc
Create an array of default values for a field instance.
content_menu in ./content.module
Implementation of hook_menu().
content_multigroup_display_overview_form in modules/content_multigroup/content_multigroup.admin.inc
Alter the "Display fields" form.
content_multigroup_fieldgroup_default_settings in modules/content_multigroup/content_multigroup.module
Implementation of hook_fieldgroup_default_settings().

... See full list

File

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

Code

function content_build_modes($selector = NULL) {
  static $info;
  if (!isset($info)) {
    $data = array();
    foreach (module_implements('content_build_modes') as $module) {
      $function = $module . '_content_build_modes';
      $data = array_merge($data, (array) $function());
    }
    $flat = array();
    foreach ($data as $tab) {

      // Use the + operator to preserve numeric indexes (core build modes).
      $flat += (array) $tab['build modes'];
    }
    $info = array(
      'tabs' => $data,
      'build modes' => $flat,
    );
  }
  if ($selector === '_tabs') {
    return $info['tabs'];
  }
  elseif (isset($selector) && isset($info['tabs'][$selector])) {
    return isset($info['tabs'][$selector]) ? $info['tabs'][$selector]['build modes'] : array();
  }
  else {
    return $info['build modes'];
  }
}