Git Product home page Git Product logo

contextual's Introduction

/* $Id */

Summary

Works for Drupal 6.

Adds contextual links for several objects like nodes, views, blocks etc. It's also an API which other modules can hook into to add or alter extra links.

You need to add an extra variable to your template files:

  • node: $node_classes
  • views: $views_classes
  • block: $block_classes
  • page: $page_classes

There is still some stuff todo - cleaning up API, settings page and other stuff which we've probably forgotten.

Use in Zen theme

In Zen theme, page, block and node templates do not have to be modified. Instead, implement hook_preprocess().

/**
 * Override or insert variables into all templates.
 *
 * @param $variables
 *   An array of variables to pass to the theme template.
 * @param $hook
 *   The name of the template being rendered (name of the .tpl.php file.)
 */
function THEME_preprocess(&$vars, $hook) {

  // Any additional contextual link types must be added to this array.
  $keys = array(
    'block_classes',
    'node_classes',
    'page_classes',

    // Zen does not override user-profile.tpl.php.
    'user_classes',
    'views_classes',
  );

  foreach ($keys as $key) {
    if (array_key_exists($key, $vars)) {
      $vars['classes_array'][] = $vars[$key];
      unset($vars[$key]);
    }
  }
}

Maintainers

contextual's People

Contributors

bangpound avatar swentel avatar stijndm avatar

Stargazers

 avatar

Watchers

 avatar James Cloos avatar  avatar

Forkers

stijndm

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.