Hierarchical Select Node Reference
Last modified: November 7, 2009 - 10:29
Overview
This module allows the use of Hierarchical Select form element as a widget for CCK node reference field, both in node add/edit form and in views filter.
Installation
See README.txt for detailed installation instructions
Example
Content Types
The example uses the following content types:
- Country
- Name
- State
- Name
- Country: Content types = Country, Required, Number of values = 1
- City
- Name
- State: Content types = State, Required, Number of values = 1
- Address
- Street
- City: Content types = City, Required, Number of values = 1
- Customer
- Name
- Addresses: Content types = Address, Required, Number of values = 5
- Order
- ShippingAddress: Content types = Address, Required, Number of values = 1
- Customer: Content types = Customer, Required, Number of values = 1
- TaxZone: Content types = TaxZone, Required, Number of values = 1
- LineItem
- Order: Content types = Order, Required, Number of values = 1
- Product: Content types = Product, Required, Number of values = 1
- Amount
- Product
- Name
- MadeBy: Content types = State or Country, Optional, Number of values = 1
- Warehouse: Content types = Address, Required, Number of values = 1
- TaxZone
- Tax
- Zone: Content types = Address or City or State or Country, Required, Number of values = 10
Node reference paths
Give the content types listed above, the following node reference paths are possible:
- LineItem.Order-Order.ShippingAddress-Address.City-City.State: Number of values = 1 and single content types at all levels
- Customer.Addresses-Address.City-City.State: Number of values > 1 at root
- This is used to test dropbox in node reference field widget
- TaxZone.Zone-City.State-State.Country: Number of values > 1 & multiple content types at root
- This is used to test save lineage in node reference field widget
- Product.MadeBy-State.Country: Number of values = 1 & multiple content types at root
- Order.Customer-Customer.Addresses-Address.City-City.State: Number of values > 1 at non-root
- Order.TaxZone-TaxZone.Zone-City.State-State.Country: Number of values > 1 & multiple content types at non-root
- When using this path as node reference field widget, it can only select tax zones containing a city
- Similarly when using this path as views filter, it can only filter zones containing a city
- Current implementation can only select an item from the last level in the path, future enhancement is needed to allow selection from middle levels
- LineItem.Product-Product.MadeBy-State.Country: Number of values = 1 & multiple content types at non-root
- Similar to #6, when using this path as field widget/views filter, it can only select/filter products made by a state (not by country)
Usage Screenshots
CCK Node Reference Field
- See http://drupal.org/node/626096 for a screenshot of the field setting for path "Order.TaxZone-TaxZone.Zone-City.State-State.Country". Please note in order for the "Node reference path" to work, "Content types that can be referenced" must be saved first.
- See http://drupal.org/node/626070 for a screenshot of the resulting field widget in an order edit form, note the order of the dropdowns in the widget is the reverse of the node reference path.
Views Filter
- See http://drupal.org/node/626098 for a screenshot of the extra setting form when you attempt to add a filter for Content: Tax Zone node reference field
- See http://drupal.org/node/626100 for a screenshot of the filter setting for path "Order.TaxZone-TaxZone.Zone-City.State-State.Country"
- See http://drupal.org/node/626102 for a screenshot of the views filter in action in live preview
