Development

sfMilonicPlugin

You must first sign up to be able to contribute.

sfMilonicPlugin

The sfMilonicCPlugin is a symfony plugin that provides easy-to-use drop-down menus based on Milonic Menus (www.milonic.com).

Installation

  • Install the plugin

    symfony plugin-install http://plugins.symfony-project.com/sfMilonicPlugin

  • To use a Milonic Menu, you need to create a menu.yml file in your app config folder. The plugin includes a example menu file (menu_example.yml) for sfGuardPlugins Modules. This example shows how to set menu styles, menus, items and submenus. You can set multiples menus for your app.

  • Finally, set the environment config handler for menu.yml in config_handlers.yml. The plugin includes a config_hanlder.yml file. Copy this file in your app config folder.
        config/menu.yml:
          class:    sfDefineEnvironmentConfigHandler
          param:
            prefix: mm_
    

  • To Show a Menu in your app follow this steps:
    • set Milonic Helper
              <?php use_helper('Milonic'); ?>
      
    • Set common milonic options. you can put this in Page Headers options, after milonic helper call.
              <?php echo milonic_options(); ?>
      
    • Retrieve menus array from sfConfig vars.
              <?php $menus = sfConfig::get("mm_milonic_menus");?>
      
    • To show an specific menu, uses milonic_menu helper function, passing menu name.
              <?php echo milonic_menu($menus['myMenu']); ?>
      
  • The best place to put the menu.

I recommend to put the menu in app layout. If app has user access control, you can set your layout to show the menu to authenticated users only.

         <?php if ($sf_user->isAuthenticated()) {echo milonic_menu($menus['myMenu']);} ?>
  • Full example:
             <?php if ($sf_user->isAuthenticated()):?>
                <?php use_helper('Milonic'); ?>    
                <?php echo milonic_options(); ?>
                <?php $menus = sfConfig::get('mm_milonic_menus'); ?>
                <?php echo milonic_menu($menus['access']);  ?>  
             <?php endif; ?>
    

1.0.1 Version

  • Support Javascript function at url field
          url: 
            function: setFrame
            params : { link: dependencias/ }
    
  • Minor bug with directory separator. Thanks nervo.net

Attachments