function colorizer_load in Colorizer 7
Loads data for an instance.
Parameters
$instance: The instance to load the data for.
$field: Return just specific field if configured.
Return value
The data or NULL if not set.
5 calls to colorizer_load()
- colorizer_admin_form in ./
colorizer.admin.inc - This is a helper function that can be used to return the "subform" of Colorizer settings to be used on any other page as needed
- colorizer_get_palette in ./
colorizer.module - Retrieves the color palette for a particular theme and instance.
- colorizer_preprocess_html in ./
colorizer.module - Implements hook_preprocess_html(). Add the colorized style sheet to the site
- colorizer_save in ./
colorizer.module - Saves the info for an instance
- colorizer_update_stylesheet in ./
colorizer.module - Create a new stylesheet by replacing color variables Basic filehandling copied from Color module Returns full path to new css file
2 string references to 'colorizer_load'
- colorizer_delete in ./
colorizer.module - Deletes the info for an instance
- colorizer_save in ./
colorizer.module - Saves the info for an instance
File
- ./
colorizer.module, line 63 - Colorize your theme
Code
function colorizer_load($instance, $field = NULL) {
$data =& drupal_static(__FUNCTION__, array());
if (!array_key_exists($instance, $data)) {
if ($cache = cache_get('colorizer_data_' . $instance)) {
$data[$instance] = $cache->data;
}
else {
$data[$instance] = db_select('colorizer_instance', 'ci')
->fields('ci', array(
'stylesheet',
'palette',
))
->condition('instance', $instance)
->execute()
->fetchAssoc();
if (!empty($data[$instance]['palette'])) {
$data[$instance]['palette'] = unserialize($data[$instance]['palette']);
}
}
}
if ($field) {
return isset($data[$instance][$field]) ? $data[$instance][$field] : NULL;
}
return $data[$instance];
}