Add menu item to site for own extension

  • Hello all,

    I'm working on a website in pagekit and at the moment I am making an events calendar.
    This means that the admin can add events to the website and the visitors can see them in a widget and under the menu item Calendar.

    That last one is making me have a headache, how do I add a menu item automaticly like pagekit-blog does?

    I found something about nodes in the index.php of the module that should show a option under the add page button in the menu edit screen but it doesn't for me.

    What am I missing?

    My index.php contains the folowing:

    My CalendarSiteController.php contains the folowing:

    And event-list.php contains:

    HTML: event-list.php
    1. <div>
    2. <h1>Hello</h1>
    3. </div>

    When I go to the /calendar route on the main site I get the h1 tag containing Hello.

    But I can't figure it out how to add the option under add page in the edit menu view off the admin panel.


  • Hi Jesse,

    I guess you want to add menu for node. Okay, You need 3 files for this.

    First file `app/components/menu/calendar-link.vue`


    Second Webpack configure


    1. "exampleWebpackName": "./app/components/menu/calendar-link.vue",

    Third File you should add array a area the index events on index.php.

    PHP: array events on index.php
    1. 'events' => [
    2. 'view.scripts' => function ($event, $scripts) {
    3. $scripts->register('exampleModule', 'extensionName:app/bundle/exampleWebpackName.js', '~panel-link');
    4. }
    5. ]

    Finally run webpack.

    Example Package