Implementing duplicated menus

This code was built for a project which included:

  • the ability to create menus
  • the ability to have duplicated menus
  • having a sidebar that contains the current selected menu

By adding node/1?b=1 at the end of the menus that were duplicated, a simple operation could verify if they menu was selected or not.

Fixing duplication requires that everytime a menu is saved, we go through the menu structure again to fix the problematic menus appending ?b=X at the end. You can either push a button in the admin interface or just modify them, as it hook on menu_link_alter.


<?php

function duplicated_menus_menu() {
$items['admin/settings/duplicated_menus'] = array(
'title' => 'Duplicated menus admin page',
'page callback' => 'drupal_get_form',
'page arguments' => array('duplicated_menus_admin_form'),
'access arguments' => array('access content'),
'type' => MENU_NORMAL_ITEM,
);
return $items;
}
function duplicated_menus_admin_form() {
$form = array();
$form['description'] = array(
'#type' => 'markup',
'#value' => t('This button force reloading the primary menus to add proper menu numbering allowing duplicates to have their own predefinite paths'),
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Reload primary links'),
);
return $form;

MeSH Vocabulary

The MeSH Vocabulary module provides a convenient method to import the large Medical Subject Headings thesaurus and also a modal popup to provide more efficient browsing.

MeSH format

This module makes use of the "MeSH Trees" format. This format allows for a reasonably fast import and preservation of term hierarchy. The XML format more commonly used includes a large amount of superfluous information and, at 260MB in size, not a viable option for a web-based import.

MeSH browser

Using the CTools modal dialog, this module overrides the default taxonomy widget to instead use an AJAX modal browser. All other taxonomies are rendered using the normal widget.

MeSH import process

  1. Download the MeSH Trees file from the above site.
  2. Navigate to Administer > Taxonomy > MeSH.
  3. Select the correct MeSH year (sets the top-level headers).
  4. Upload the MeSH Trees file.
  5. Save configuration.
  6. Click "Populate MeSH vocabulary" to begin the import process.
  7. After completion, you may add the MeSH vocabulary to any content type to use.

System Requirements

    Installing LayoutStudio 2.x for Drupal 6

    A YouTube video showing the installation process is also available

    1. Download LayoutStudio

    2. Unpack the downloaded file, and place the layoutstudio folder in your sites/all/themes

    Installing LayoutStudio 1.x for Drupal 7

    A YouTube video showing the installation process is also available

    1. Download LayoutStudio

    2. Unpack the downloaded file, and place the layoutstudio folder in your sites/all/themes

    Sections Module: Section based on book chapter

    This snippet goes in Administer -> Site Building -> Sections -> <section> -> Page Specific Visibility Settings, and allows you to specify a section based on the book chapter name. The sectioning applies to the selected chapter and all children.

    Prerequisite: Sections Module

    Change $chapter_name to the exact name of the book chapter that you want to be the start of the new section.
    Change $chapter_level to the chapter level to check at. Level 0 may work, but is untested.

    How the levels are counted by this snippet:

    Book Title (level 0)
    -- Chapter 1 (level 1)
    ---- Chapter 1.1 (level 2)
    ------ Chapter 1.1.1 (level 3)
    ------ Chapter 1.1.2 (level 3)
    ------ Chapter 1.1.3 (level 3)
    ---- Chapter 1.2 (level 2)
    ------ Chapter 1.2.1 (level 3)
    ------ Chapter 1.2.2 (level 3)
    -- Chapter 2 (level 1)
    ---- Chapter 2.1 (level 2)
    ------ Chapter 2.1.1 (level 3)
    ------ Chapter 2.1.2 (level 3)
    ------ Chapter 2.1.3 (level 3)
    ---- Chapter 2.2 (level 2)
    ------ Chapter 2.2.1 (level 3)
    ------ Chapter 2.2.2 (level 3)

    Why? Well, I wanted to set different themes for different book chapters, but any module that uses the Sections Module should be able to work with this.


    <?php
    $chapter_name = "Chapter 1"; $chapter_level = 1;
    $match = FALSE;

    Pages

    Subscribe with RSS Subscribe to RSS - Needs copy/style review