Assign fuel_navigation_id to a Module Object

edited September 2012 in Modules
I have an 'Articles' module (based off the Fuel tutorial: http://http://www.getfuelcms.com/user_guide/modules/tutorial)

I'd like our users to be able to assign an 'Article' to a Navigation location. The Navigation is being handled through the Navigation module in Fuel. Within the Fuel CMS Article Module edit form, I want to have a select list that represents the Navigation model.

in application/models/application_model.php I have tried this:
public $foreign_keys = array('fuel_navigation_id', 'navigation_model'); function form_fields($values = array()) { ... $CI =& get_instance(); $CI->load->module_model(FUEL_FOLDER, 'navigation_model'); ... }

When I load the articles/edit URI I receive the following error:
An Error Was Encountered Unable to locate the file: fuel_navigation_id.php

Is there a best-practice approach to assigning objects from custom modules to a navigation section? Where I would expect then to be able to create a dynamic page that loads the objects assigned to that navigation section.

Comments

  • edited 5:37AM
    Try the following for $foreign_keys:
    public $foreign_keys = array('fuel_navigation_id' => 'navigation_model');
  • edited 5:37AM
    aha! silly syntax error. Ok, so that go rid of the error message. Now to get the resulting select box to show the Navigation labels instead of just the Navigation id (of repeated '1' which I am assuming is actually the navigation group id?)
  • edited 5:37AM
    By default, it will use the 3rd column for a dropdown. However, you can overwrite your options_list method to use a different column like so. The navigation_model does this to some extent.
Sign In or Register to comment.