Interchange6::Schema::Result::Navigation
Navigation is where all navigation, category and static page details are stored. In addition information such as page title can be linked to these records as attributes.
Common attribute names for a Navigation records include these examples.
meta_title meta_description meta_keywords head_js head_css
NOTE: with items such as head_css which may contain more than one record you must set the priority of the record. This ensures each record has a unique value and also allows for proper ordering.
$nav->add_attribute({name => 'head_css', priority => '1'}, '/css/main.css'); $nav->add_attribute({name => 'head_css', priority => '2'}, '/css/fancymenu.css');
Primary key.
URI.
Unique constraint. Is nullable.
See "generate_uri" method for details of how "uri" can be created automatically based on the value of "name".
Type, e.g.: nav, category.
Scope, e.g.: menu-main, top-login.
Name, e.g.: Hand Tools, Fly Fishing Rods.
Defaults to empty string.
Description, e.g.: All of our hand tools, Our collection of top fly fishing rods.
FK on "navigation_id" in Interchange6::Schema::Result::Navigation.
Can be used for things such as menus in different languages which link back to the primary navigation menu.
Is nullable.
Used by DBIx::Class::Tree::AdjacencyList to setup parent/child relationships.
Signed integer priority. We normally order descending.
Defaults to 0.
Can be used to cache product counts.
Default to 0.
Date and time when this record was created returned as DateTime object. Value is auto-set on insert.
Date and time when this record was last modified returned as DateTime object. Value is auto-set on insert and update.
Whether navigation is active and therefore should be displayed.
Boolean defaults to true (1).
Attribute methods are provided by the Interchange6::Schema::Base::Attribute class.
Override inherited method to call "generate_uri" method in case "name" has been supplied as an argument but "uri" has not.
NOTE: is uri is supplied and is undefined then "generate_uri" is not called.
See "with_active_child_count" in Interchange6::Schema::ResultSet::Navigation for a resultset method which will prefill this data.
See "with_active_product_count" in Interchange6::Schema::ResultSet::Navigation for a resultset method which will prefill this data.
Called by "new" if no uri is given as an argument.
The following steps are taken:
1. Stash $self->name in $uri to allow manipulation via filters
$self->name
$uri
2. Remove leading and trailing spaces and replace remaining spaces and / with -
/
-
3. Search for all rows in Interchange6::Schema::Result::Setting where scope is Navigation and name is <generate_uri_filter>
scope
Navigation
name
4. For each row found eval $row->value
$row->value
5. Finally set the value of column "uri" to $uri
Filters stored in Interchange6::Schema::Result::Setting are executed via eval and have access to $uri and also the navigation result held in $self
$self
Examples of filters stored in Setting might be:
{ scope => 'Navigation', name => 'generate_uri_filter', value => '$uri =~ s/badstuff/goodstuff/gi', }, { scope => 'Navigation', name => 'generate_uri_filter', value => '$uri = lc($uri)', },
Similar to the inherited siblings method but also returns the object itself in the result set/list.
parent
ancestors
has_descendant
parents
children
attach_child
siblings
attach_sibling
is_leaf
is_root
is_branch
Related object: Interchange6::Schema::Result::Navigation
Conditions: self.parent_id = foreign.navigation_id && foreign.active = 1
Type: has_many
Related object: Interchange6::Schema::Result::MediaNavigation
Related object: Interchange6::Schema::Result::NavigationProduct
Type: many_to_many
Accessor to related product results ordered by priority and name.
Related object: Interchange6::Schema::Result::NavigationAttribute
Accessor to related attribute results.
Related object: Interchange6::Schema::Result::NavigationMessage
Accessor to related Message results.
To install Interchange6::Schema, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Interchange6::Schema
CPAN shell
perl -MCPAN -e shell install Interchange6::Schema
For more information on module installation, please visit the detailed CPAN module installation guide.