You are here

function delta_theme_overrides in Delta 7

Same name and namespace in other branches
  1. 6 delta.module \delta_theme_overrides()

Menu callback for admin/build/delta/%.

1 string reference to 'delta_theme_overrides'
delta_menu in ./delta.module
Implementation of hook_menu().

File

./delta.module, line 200
The Delta Theme API is an advanced manipulation of the Theme Settings API to allow for customization/configuration of theme settings based on node types, context, or groups of paths.

Code

function delta_theme_overrides($theme) {
  $result = db_query("\n    SELECT \n      did, tid, system_name, name, weight, value \n    FROM {delta_theme_overrides} \n    WHERE theme = '%s'\n    ORDER BY weight ASC", $theme);
  while ($delta = db_fetch_object($result)) {
    $conditions = unserialize($delta->value);
    $data[$delta->did] = array(
      'did' => $delta->did,
      'tid' => $delta->tid,
      'name' => $delta->name,
      'system_name' => $delta->system_name,
      'weight' => $delta->weight,
      'conditions' => array(
        'nodes' => $conditions['node-types'],
        'contexts' => $conditions['contexts'],
        'paths' => $conditions['paths'],
      ),
    );
  }

  // add the override form to the page
  $output = '<h2>Theme Settings Overrides</h2>';
  $output .= drupal_get_form('delta_theme_overrides_form', $theme, $data);

  // get the theme settings template for this theme
  $template_result = db_query("\n    SELECT\n      name, tid\n    FROM {delta_theme_settings}\n    WHERE theme = '%s'\n    ORDER BY name ASC\n  ", $theme);
  $output .= '<div class="template-overrides"><h2>Theme Settings Templates</h2>';
  while ($templates = db_fetch_object($template_result)) {
    $output .= '<div>' . $templates->name . ' <a href="">edit</a></div>';
  }
  $output .= '</div>';
  return $output;
}