Fuel Navigation Model Class
Fuel_navigation_model is used for managing FUEL users in the CMS.
This class extends the Base_module_model class.
Properties Reference
Property | Default Value | Description |
---|---|---|
public | ||
group_id | 1 | The default navigation group ID |
required |
array('label', 'group_id' => 'Please create a Navigation Group', ) |
The label and group_id are required fields |
filters |
array('label', 'location') |
The label and location |
filter_join |
array('label' => 'or', 'location' => 'or', 'group_id' => 'and', ) |
The search filters will look in label OR location from within a specified group_id |
record_class | Fuel_navigation_item | The name of the record class |
ignore_replacement |
array('nav_key') |
The "nav_key" will be ignored upon replacement |
linked_fields |
array('nav_key' => array ( [location] => mirror ) ) |
Nav_key and location value will mirror each other by default |
boolean_fields |
array('hidden') |
The hidden field is considered a boolean field which allows us to toggle it between "yes" and "no" in the list view of the admin |
Function Reference [+]
$this->fuel->navigation_model->list_items(['$limit'=NULL], ['$offset'=NULL], ['$col'='nav_key'], ['$order'='desc'], ['$just_count'=FALSE])
Lists the module's items.
Returns
mixed If $just_count is true it will return an integer value. Otherwise it will return an array of data (optional)
Parameters
(int) $limit The limit value for the list data (optional) (int) $offset The offset value for the list data (optional) (string) $col The field name to order by (optional) (string) $order The sorting order (optional) (boolean) $just_count Determines whether the result is just an integer of the number of records or an array of data (optional)
$this->fuel->navigation_model->find_by_location('$location', ['$group_id'=1], ['$lang'=NULL])
Returns an array of page information based on the location.
Returns
array
Parameters
(string) $location The location value of the menu item (mixed) $group_id The group that the menu item belongs to. Can be a string (name) or an int (ID) (optional) (string) $lang The language of the navigation item (optional)
$this->fuel->navigation_model->find_by_nav_key('$nav_key', ['$group_id'=1], ['$lang'=NULL])
Returns an array of page information based on the location.
Returns
array
Parameters
(string) $nav_key The nav_key value of the menu item (mixed) $group_id The navigation group name (string) or ID (int) value (optional) (string) $lang The language of the navigation item (optional)
$this->fuel->navigation_model->tree(['$just_published'=FALSE])
Tree view that puts navigation items in a hierarchy based on their location value.
Returns
array An array that can be used by the Menu class to create a hierachical structure
Parameters
(boolean) $just_published Determines whether to return just published navigation items or not (optional... and ignored in the admin)
$this->fuel->navigation_model->find_all_by_group(['$group_id'=1], ['$lang'=NULL], ['$assoc_key'=NULL])
Finds all menu items based on a group value.
Returns
array
Parameters
(mixed) $group_id The navigation group name (string) or ID (int) value (optional) (string) $lang The language of the navigation item (optional) (string) $assoc_key The column name to be used as the key value
$this->fuel->navigation_model->max_id()
Finds the max menu ID value. Used when importing menu items.
Returns
int
$this->fuel->navigation_model->form_fields([$values=array()], [$related=array()])
Navigation form fields.
Returns
array An array to be used with the Form_builder class
Parameters
(array) $values Values of the form fields (optional) (array) $related An array of related fields. This has been deprecated in favor of using has_many and belongs to relationships (deprecated)
$this->fuel->navigation_model->no_location_and_parent_match($parent_id)
Validation callback method to make sure that the location and parent ID's don't match (to prevent infinite recursive loopiness).
Returns
boolean
Parameters
(array) $parent_id The parent ID of the navigation item
$this->fuel->navigation_model->is_new_navigation('$nav_key', '$group_id', '$lang')
Validation callback method to make sure that new navigation item doesn't already exist with the same nav_key, group_id and language values.
Returns
boolean
Parameters
(string) $nav_key The nav_key value of the menu itemparent ID of the navigation item (mixed) $group_id The navigation group name (string) or ID (int) value (string) $lang The language of the navigation item
$this->fuel->navigation_model->is_editable_navigation('$nav_key', '$group_id', '$id', '$lang')
Validation callback method to make sure that existing navigation item doesn't change values to already existing navigation with the same nav_key, group_id and language values.
Returns
boolean
Parameters
(string) $nav_key The nav_key value of the menu itemparent ID of the navigation item (mixed) $group_id The navigation group name (string) or ID (int) value (int) $id The navigation's ID value (string) $lang The language of the navigation item
$this->fuel->navigation_model->is_new_location('$location', '$group_id', '$parent_id', '$lang')
Validation callback method to make sure that new navigation item doesn't already exist with the same location, group_id and language values.
Returns
boolean
Parameters
(string) $location The location value of the menu itemparent ID of the navigation item (mixed) $group_id The navigation group name (string) or ID (int) value (string) $parent_id The language of the navigation item
$this->fuel->navigation_model->on_before_clean($values)
Model hook right before the data is cleaned. Cleans up location value if needed.
Returns
array Returns the values to be cleaned
Parameters
(array) $values The values to be saved right the clean method is run
$this->fuel->navigation_model->on_before_validate($values)
Model hook executed right before validation is run to add additional navigation validation.
Returns
array Returns the values to be validated right before saving
Parameters
(array) $values The values to be saved right before validation
$this->fuel->navigation_model->_common_query(['$params'=NULL])
Common query that joins fuel_navigation_groups table info.
Returns
void
Parameters
(mixed) $params parameter to pass to common query (optional)
$this->fuel->navigation_model->options_list(['$key'='id'], ['$val'='label'], [$where=array()], ['$order'=TRUE], ['$group'=TRUE])
Overwritten: Allows for grouping of menu items with last paramter.
Parameters
(string) $key The column to use for the value (optional) (string) $val The column to use for the label (optional) (mixed) $where An array or string containg the where paramters of a query (optional) (string) $order The order by of the query. defaults to $val asc (optional) (boolean) $group Determines whether it will group the options together based on the menu troup (optional)
$this->fuel->navigation_model->get_others('$display_field', ['$id'=NULL], ['$val_field'=NULL])
Overwritten: Allows for grouping of menu items with last paramter.
Returns
array Key/value array
Parameters
(string) $display_field The field name used as the label (int) $id The current value... and actually deprecated (optional) (string) $val_field The value field (optional)
Fuel Navigation Item Model Class
This class extends the Base_module_record class.