Share » Forums » Developer » Tips for creating an extension for...

Tips for creating an extension for the admin interface?

Tips for creating an extension for the admin interface?

Monday 26 March 2007 11:54:39 am - 5 replies

Author Message

Felix Woldt

Monday 26 March 2007 12:42:01 pm

hi,

to add a top level navigation like 'content' odr 'setup' you only need a ini settings

menu.ini.append.php
this is an example from extension ezadmin

[NavigationPart]
Part[ezadmin]=Admin

[TopAdminMenu]
Tabs[]=ezadmin

[Topmenu_ezadmin]
NavigationPartIdentifier=ezadmin
Name=Admin
Tooltip=Helps Administrating your System
URL[]
URL[default]=/admin/menu
Enabled[]
Enabled[default]=true
Enabled[browse]=false
Enabled[edit]=false
Shown[]
Shown[default]=true
Shown[edit]=true
Shown[navigation]=true
Shown[browse]=false

If you want to have another leftnavigation you have to define a new 'navigationpart' in your extension. For each module function you can specify which navigationpart is used.
In the pagelayout.tpl of the admin interface their is a navigationpartswitch, which define which parts/menu.tpl is used. Here you have to extend the pagelayout for your custom navigationpart. (create a new override template)

example from default design/admin/templates/pagelayout.tpl

{section show=eq( $navigation_part.identifier, 'ezcontentnavigationpart' )}
    {include uri='design:parts/content/menu.tpl'}
{/section}

Hope this will help a little bit.

Best regards
Felix

http://www.jac-systeme.de - Developers united in eZ Publish: http://www.cjw-network.com

CJW Newsletter 1.0.0 released: http://projects.ez.no/cjw_newsletter

Luis Cruz

Tuesday 27 March 2007 6:58:54 am

Felix, thanks for the initial tips. However, I don't want to create a brand new top level navigation or an entirely new left hand navigation part. I want my extension to add a new item onto an existing navigation part (specifically, part/visual/menu.tpl). Is there a way to append an item to an existing navigation part, or do you have to override the entire part?

For example, part/visual/menu.tpl currently renders these items:
* Look and feel
* Menu management
* Toolbar management
* Templates

I would like the menu to read like this after someone installs my extension:
* Look and feel
* Menu management
* Toolbar management
* Templates
* My Extension

Ideally, I don't want the user to have to manually override their templates; install the extension, and it is done for you. I haven't found a way to do this in eZ publish, but I'm not sure that means it isn't possible.

Thanks.

André R.

Tuesday 27 March 2007 8:07:19 am

You can either include override.ini in the myextension/settings folder of your extension or you can place the override template in myextension/design/admin/templates/parts/visual/menu.tpl

In both examples, with a design.ini in myextensions/settings looking like this:

#?ini charset="utf-8"?
# eZ publish configuration file for modules

[ExtensionSettings]
DesignExtensions[]=myextension

you'll only have to activate the extension to make it work.

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

Piotrek Karaś

Monday 17 December 2007 9:32:13 pm

Felix wrote:
<i>If you want to have another leftnavigation you (...) create a new override template</i>

As distributed as eZ Publish'es template system is, pagelayout somehow remains this one, comparatively big file with lots of stuff in it, which means it generally has greater chances of being updated/upgraded ;). Making an extension dependent on admin's pagelayout override seems not very elegant to me, wouldn't you say?

However, there's way around that, right below the switch you mentioned, there is (at least in eZ Publish 4.0) this extra part:

{section show=is_set( $module_result.left_menu )}
    {include uri=$module_result.left_menu}
{/section}

So it is enough to place in your own module/view.php file something like this:

$Result['left_menu'] = 'design:parts/customnavigationpart/menu.tpl';

And we're home ;)

--
Company: mediaSELF Sp. z o.o., http://www.mediaself.pl
eZ references: http://ez.no/partners/worldwide_partners/mediaself
eZ certified developer: http://ez.no/certification/verify/272585
eZ blog: http://ez.ryba.eu

Pascal Specht

Thursday 07 February 2008 1:49:04 am

Hi Piotrek,

the idea with

$Result['left_menu'] = 'design:parts/customnavigationpart/menu.tpl';

works like a charm on 3.9.3 as well.

Thanks for the hint,

</Pascal>

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu