You are here

function colors_get_colors in Colors 7

Gets the color of a given selector.

Parameters

$selector: The name of the selector.

$module: The name of the module.

$default: If this function is being called for the default selector.

Return value

Color configuration for the giving selector, or the default.

2 calls to colors_get_colors()
colors_admin_settings in includes/colors.admin.inc
Form constructor for the Colors admin form.
colors_generate_settings_form in includes/colors.admin.inc
Generate an admin form for each Colors plugin.

File

./colors.module, line 150
Provides an API to match selectors with a color configuration.

Code

function colors_get_colors($selector, $module = 'colors', $default = FALSE) {
  $result = db_select('colors', 'c')
    ->fields('c', array(
    'color',
  ))
    ->condition('selector', $selector)
    ->execute()
    ->fetchField();
  if (!empty($result)) {
    return unserialize($result);
  }
  if (!$default) {
    return colors_get_colors($module . '_default', $module, TRUE);
  }
}