You are here

function web_widgets_get_styles in Web Widgets 7

Same name and namespace in other branches
  1. 6 web_widgets.module \web_widgets_get_styles()

Get a list of styles from the subdirectories.

Return value

Associative array where the keys of the array are style id strings and the values are human readable style names.

4 calls to web_widgets_get_styles()
theme_web_widgets_embed_code in ./web_widgets.module
Shows the widget code to the user. Usually appears when the widget display is attached to a page display. In most cases you don't want to call this function directly, but use web_widgets_render_embed_code() to render embed code.
web_widgets_plugin_display_web_widgets::options_form in views/web_widgets_plugin_display_web_widgets.inc
Provide the default form for setting options.
web_widgets_plugin_display_web_widgets::options_summary in views/web_widgets_plugin_display_web_widgets.inc
Provide the summary for page options in the views UI.
web_widgets_theme in ./web_widgets.module
Implements hook_theme().

File

./web_widgets.module, line 47
web_widgets module main. Contains the views api hook and theming functions.

Code

function web_widgets_get_styles() {
  $styles = array();
  $module_main = drupal_get_path('module', 'web_widgets');
  $dir = opendir($module_main);
  while (($style = readdir($dir)) !== FALSE) {
    if (is_dir($module_main . '/' . $style) && is_file(web_widgets_get_style_inc($style))) {
      require_once DRUPAL_ROOT . '/' . web_widgets_get_style_inc($style);
      $def = 'web_widgets_style_' . $style;
      $definition = $def();
      $styles[$style] = isset($definition['human_readable']) ? $definition['human_readable'] : $style;
    }
  }
  return $styles;
}