You are here

function styles_presets in Styles 7

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

Return an array of all style presets.

7 calls to styles_presets()
styles_field_formatter_info in ./styles.module
Implements hook_field_formatter_info().
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_add_form_submit in contrib/styles_ui/styles_ui.admin.inc
Submission handler for the add style preset form.
styles_ui_preset_add_form_validate in contrib/styles_ui/styles_ui.admin.inc
Validation handler for the add style preset form.

... See full list

File

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

Code

function styles_presets() {
  $presets =& drupal_static(__FUNCTION__);

  // First check the cache.
  if (!isset($presets)) {

    // Build the default presets.
    $presets = array();
    module_load_all_includes('inc', 'styles');
    foreach (module_implements('styles_presets') as $module) {
      $styles_containers = module_invoke($module, 'styles_presets');
      foreach ($styles_containers as $field_type => $preset) {
        foreach ($preset as $preset_name => $container) {
          foreach ($container as $container_name => $styles) {
            foreach ($styles as $style_name) {
              if ($style = styles_containers_available_styles($field_type, $container_name, $style_name)) {
                if (!isset($presets[$field_type])) {
                  $presets[$field_type] = array();
                }
                if (!isset($presets[$field_type][$preset_name])) {
                  $presets[$field_type][$preset_name] = array();
                }
                if (!isset($presets[$field_type][$preset_name][$container_name])) {
                  $presets[$field_type][$preset_name][$container_name] = array();
                }
                $presets[$field_type][$preset_name][$container_name][$style_name] = $style;
              }
            }
          }
        }
      }
    }

    // @TODO
    // Add user-defined presets and overrides.
    // Save the cache.
  }
  return $presets;
}