You are here

function styles_styles in Styles 6

Same name and namespace in other branches
  1. 7 styles.module \styles_styles()

Get an array of all available styles.

1 call to styles_styles()
styles_containers_available_styles in ./styles.module
Grab all styles available to a specific field type/container.

File

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

Code

function styles_styles() {
  $styles =& _styles_drupal_static(__FUNCTION__);

  // Grab from cache or build the array.
  if (!isset($styles)) {
    if ($cache = cache_get('styles_styles', 'cache')) {
      $styles = $cache->data;
    }
    else {
      $styles = array();
      module_load_all_includes('inc', 'styles');
      foreach (module_implements('styles_styles') as $module) {
        $module_styles = module_invoke($module, 'styles_styles');
        foreach ($module_styles as $field_name => $containers) {
          if (!isset($styles[$field_name])) {
            $styles[$field_name] = array(
              'containers' => array(),
            );
          }
          foreach ($containers['containers'] as $container_name => $container) {
            if (!isset($styles[$field_name]['containers'][$container_name])) {
              $styles[$field_name]['containers'][$container_name] = array();
            }
            foreach ($container['styles'] as $style_name => $style) {
              $style['name'] = $style_name;
              $style['module'] = $module;
              $style['storage'] = STYLES_STORAGE_DEFAULT;
              $styles[$field_name]['containers'][$container_name]['styles'][$style_name] = $style;
            }
          }
        }
      }
      drupal_alter('styles_styles', $styles);
      cache_set('styles_styles', $styles);
    }
  }
  return $styles;
}