You are here

function styles_containers in Styles 7

Same name and namespace in other branches
  1. 6 styles.module \styles_containers()

Get an array of all defined style containers.

6 calls to styles_containers()
styles_containers_load in ./styles.module
Load a specific array of styles containers.
styles_ui_containers_overview in contrib/styles_ui/styles_ui.admin.inc
Page callback for various styles preset overview listing pages.
styles_ui_menu in contrib/styles_ui/styles_ui.module
Implements hook_menu().
styles_ui_preset_edit_form in contrib/styles_ui/styles_ui.admin.inc
Callback for the preset edit form.
styles_ui_preview_ajax in contrib/styles_ui/styles_ui.admin.inc

... See full list

File

./styles.module, line 169
Bundles similar display formatters together.

Code

function styles_containers() {
  $containers =& drupal_static(__FUNCTION__);

  // Grab from cache or build the array.
  if (!isset($containers)) {
    if ($cache = cache_get('styles_containers', 'cache')) {
      $containers = $cache->data;
    }
    else {
      module_load_all_includes('inc', 'styles');
      foreach (module_implements('styles_containers') as $module) {
        $module_containers = module_invoke($module, 'styles_containers');
        foreach ($module_containers as $field_type => $field_container) {
          $containers[$field_type]['field_name'] = $field_type;
          if (isset($field_container['admin'])) {
            $containers[$field_type]['admin'] = $field_container['admin'];
          }
          if (isset($field_container['help'])) {
            $containers[$field_type]['help'] = $field_container['help'];
          }
          foreach ($field_container['containers'] as $container_name => $container) {
            $container['name'] = $container_name;
            $container['module'] = $module;
            $container['available styles'] = styles_containers_available_styles($field_type, $container_name);
            $containers[$field_type]['containers'][$container_name] = $container;
          }
        }
      }
      drupal_alter('styles_containers', $containers);
      foreach ($containers as $field_type => $container) {

        // Sort the containers by weight.
        uasort($containers[$field_type]['containers'], 'styles_uasort');
      }
      cache_set('styles_containers', $containers);
    }
  }
  return $containers;
}