Member
Member
vincent3569   2019-04-01, 06:56
#1
hi

I try to create a default custom menu for zpBootstrap.
First, I create my default custom menu with menu manager : Home page, Gallery page, News index, and Pages list).
I can see menu items in my db and I can see all my items in my FE.

Second, I have a look on garland and zenpage themeoptions files and `if (function_exists('createMenuIfNotExists')) {...}` statements.

Third, I try to create my default custom menu in my own themeoptions file, based on existing values in my db and examples of official themes.

So, I have he following code:
```
if (class_exists('menu_manager')) {
$menuitems = array(
array('type' => 'homepage', 'title' => gettext('Home'), link => '', 'show' => 1, 'nesting' => 0),
array('type' => 'zenpagenewsindex', 'title' => gettext('News'), link => '', 'show' => 1, 'nesting' => 0),
array('type' => 'galleryindex', 'title' => gettext('Gallery'), link => '', 'show' => 1, 'nesting' => 0),
array('type' => 'menufunction', 'title' => gettext('Pages'), link => "printPageMenu('list-top', '', 'active', '', '', '', 0, false);", 'show' => 1, 'nesting' => 0),
);
createMenuIfNotExists($menuitems, 'zpBootstrap');
}
```

I have 2 issues.

First one:
for `homepage`item, I have this message in debug log:
`createMenuIfNotExists item 0 has an invalid type.`
==> so homepage type seems to be invalid and something should by missing in menu_manager plugin.

Second one:
for each item, I have `link => ''` and for each item, I have this message in debug log:
` WARNING: Use of undefined constant link - assumed 'link' (this will throw an Error in a future version of PHP) in /home/avbo7291/public_html/zenphoto__test/themes/zpBootstrap/themeoptions.php on line 51
ThemeOptions->__construct called from admin-themes.php [38] `.

I don't understand this issue.
In fact, with items created by menu manager admin, links in db are empty and with garland and zenpage, there are similar statements with emply links
`array('type' => 'menulabel', 'title' => gettext('News Articles'), 'link' => '', 'show' => 1, 'nesting' => 0),`
and in db there is a value like `600584c2d5ccb97c0c0c424d9f32d6b102fcb040`.
==> so something is OK when created with menu manager admin but KO when created by php code and inserted values in db.

can you help me?
Member
Member
vincent3569   2019-04-01, 07:25
#2
oops, my mistake for `link` issue: it should be `'link'`.

the first issue remain: `homepage` type is missing in `createMenuIfNotExists()` function.
Administrator
Administrator
acrylian   2019-04-01, 09:01
#3
I will be looking at the first issue, probably I just forgot it when adding the new "homepage" item type (which is of course not yet officially released and only in the support build for all else reading here).
Member
Member
vincent3569   2019-04-01, 10:41
#4
thanks fr the commit.
as far I can test, it works well
Member
Member
vincent3569   2019-04-01, 10:56
#5
there are 2 other issues with menu_manager.

- first one: when you delete a 3rd party menu set, there is a wrong refresh of the page and the deleted menu set remains.
this issue doesn't exist when I try to delete zenpage or garland custom menu set.

- second one
on my own custom menu set, I have the following statement:
Pages: `printPageMenu('list-top', '', 'active', '', '', '', 0, false);`
I am unable to delete this menu item: the 'red cross' doen't delete item (but delete bulk action delete it).

fyi, I am able to delete other menu items and I am able to delete the same menu item in zenpage and garland custom menu set.

Member
Member
vincent3569   2019-04-01, 11:07
#6
hi
I found the 2nd one.
in my themeoptions.php, I replace
`array('type' => 'menufunction', 'title' => gettext('Pages'), link => "printPageMenu('list-top', '', 'active', '', '', '', 0, false);", 'show' => 1, 'nesting' => 0),` by this one
`array('type' => 'menufunction', 'title' => gettext('Pages'), 'link' => 'printPageMenu("list-top", "", "active", "", "", "", 0, false);', 'show' => 1, 'nesting' => 0),`.

the '' and "" brakes html flow :-(
Administrator
Administrator
acrylian   2019-04-01, 11:08
#7
Thanks, quotes are often causing fun ;-)
  
Powered By MyBB, © 2002-2026 MyBB Group.
Made with by Curves UI.