hierarchical-select

Code

  1. /**
  2.  * Helper function to reconstruct the lineages given a set of selected items
  3.  * and the fact that the "save lineage" setting is enabled.
  4.  *
  5.  

The Most Monstrous Function Ever

  1. /**
  2.  * Hierarchical select form element type #process callback.
  3.  */
  4. function hierarchical_select_process($element) {
  5.   static $hsid;
  6.  
  7.   if (!isset($hsid)) {
  8.     $hsid = 0;
  9.   }
  10.   else {

HS demo cleanup

  1. /**
  2.  * Implementation of hook_cron().
  3.  */
  4. function hsdemo_cron() {
  5.   $last_cleanup = variable_get('hsdemo_last_cleanup', 0);
  6.  
  7.   $delta = 7200; // 2 hours.

With inline comments this time!

  1. /**
  2.  * Definition of our hierarchy.
  3.  */
  4. function hs_tutorial_hierarchy() {
  5.   static $internal_hierarchy;
  6.  
  7.   // The user-visible hierarchy. Only defines labels. Has 3 levels.

Code

  1. /**
  2.  * Definition of our hierarchy.
  3.  */
  4. function hs_tutorial_hierarchy() {
  5.   static $internal_hierarchy;
  6.  
  7.   // The user-visible hierarchy. Only defines labels. Has 3 levels.

Code

  1. /**
  2.  * Implementation of hook_requirements().
  3.  */
  4. function hs_views_taxonomy_requirements($phase) {
  5.   $requirements = array();
  6.  
  7.   if ($phase == 'runtime') {
  8.     $pattern = <<<EOT

Code

  1. $config = array(
  2.   'config_id'       => 'taxonomy-1',
  3.   'save_lineage'    => 1,
  4.   'enforce_deepest' => 0,
  5.   'node_count'      => 1,
  6.   'level_labels' => array(
  7.     'status' => 1,

Hierarchical Select example

  1.  $form['select_some_term'] = array(
  2.     '#type' => 'hierarchical_select',
  3.     '#title' => t('Select the tag you wish to use.'),
  4.     '#config' => array(
  5.       'module' => 'taxonomy',

AHAH callback in Drupal 5

  1. <?php
  2. /**
  3.  * Menu callback; format=text/json; generates and outputs the appropriate HTML.
  4.  */
  5. function hierarchical_select_json() {

vocabselect - a Hierarchical Select implementation

  1. <?php
  2. // $Id$
  3.  
  4. /**
  5.  * @file
  6.  * Puts a configurable list of vocabularies in the first select of a
  7.  * Hierarchical Select, and allows to select a term beneath that.
  8.  */
  9.  
  10.  
Syndicate content