Launch form from CMS menu

Below is a picture of the CMS menu for this site.

 

The CMS menu is displayed when you move the mouse cursor over the bars icon in the top left corner of the browser. The menu has two levels. The first level defines a menu section. The second level defines an action or form to be loaded when the menu is clicked. Menu options are defined in a yaml file named cms_menu.yaml located in forms folder. It can be expected that every project or plugin have its own cms_menu file and menu is build from all these files. Here is an example of cms_menu file provided with drg_books project.

 

menu:
  80_dc_books:
    caption: Books
    icon: book lg       
    items:
      10:
        caption: helpers.label.dc_book.tabletitle
        controller: cmsedit
        icon: book lg       
        table: dc_book
      20:
        caption: helpers.label.dc_book_chapter.tabletitle
        controller: cmsedit
        icon: file-text-o lg       
        table: dc_book_chapter

  

Top option menu is required. On the next level, a menu section is defined. It is preceded by number, which helps when sorting menu sections. System menu has value of 10_system_menu. Caption and icon do not need explanation. This example is using font awesome icons. If you want, you can also use picture files.

 

Items define menu items. They are numbered for sorting purposes and since they are loaded in order defined by adding form paths to DrgCms, gems loaded later can overwrite menu items defined earlier. It is also possible to insert menu items in already defined menu. Other options are again the same as options for dc_link_to helper.

 

 

 

 


Last update: 26.01.2022