get_items_in_path in Menu.php - how is this supposed to work with breadcrumbs
I am trying to use the breadcrumb function to create a breadcrumb - but I think there is a bug in the generation code.
If you look at...
https://github.com/daylightstudio/FUEL-CMS/blob/develop/fuel/modules/fuel/libraries/Menu.phpat line 1048, it looks for your place in the menu structure by looking at the key of the array and seeing if it matches the active page
if (isset($this->_items[$active]))
But my menu's are loaded from the CMS and seem to have numbers as the key
[29] => Array
(
[id] => 29
[label] => - Our Clients
[location] => /about/clients
[attributes] =>
[active] =>
[parent_id] => 3
[hidden] => no
[group_id] => 1
[nav_key] => /about/clients
[precedence] => 0
[selected] =>
[language] => english
[published] => yes
[group_name] => main
)
I don't see how this can work when your menu's come from the CMS. It should be looking to match the "location" I believe
Comments
There is also a parameter to pass to fuel_nav called "use_nav_key" if set to TRUE will look at the location value as opposed to the ID value. This is set to "AUTO" by default.
But since $return still has numeric array keys it never matches.
if ($this->use_nav_key !== FALSE AND isset($return[$this->active]['nav_key']))
{
$active = $return[$this->active]['nav_key'];
}
$this->active = "/about/clients";
and one of the elements of $return =
[29] => Array
(
[id] => 29
[label] => - Our Clients
[location] => /about/clients
[attributes] =>
[active] =>
[parent_id] => 3
[hidden] => no
[group_id] => 1
[nav_key] => /about/clients
[precedence] => 0
[selected] =>
[language] => english
[published] => yes
[group_name] => main
)
so isset($return[$this->active]['nav_key'])) is never true.
echo $this->fuel->navigation->breadcrumb();
But that being said the url's are functionally the same as far as the webserver/cms is concerned for displaying the page.
I wonder if the compare should be more involved, I am generating some navigation from the pages structure rather than the menu and I am matching up using something like this
$search_key = array_values(array_filter(explode('/', $page_name)));
"go/here/for//links"
"/go/here/for/links"
Both gets somewhat normalized to
Array
(
[0] => go
[1] => here
[2] => for
[3] => links
)
But thanks for looking at my problem
Dave Dula
public function on_before_save($values)
{
$CI = get_instance();
$user = $CI->fuel->auth->user_data();
$values['last_modified_by'] = $user['id'];
// DOC XXX
$search_key = array_values(array_filter(explode('/', $values['location'])));
$values['location']=(implode('/',$search_key));
return $values;
}