edit

Settings

Note

Settings can be injected, if mandatory, using Dropmenu::display($type, $settings). It has been cascaded from v1.6.1 (CHANGELOG)

Available Options

Icon Settings

These settings are not mandatory by default. They give an extensive support for customizing the dropdown menu. The Icon Settings consits of three customizable attributes:

  • prefix: Prefix is the starting element that are provided before the value of the icon table. By Default it is set to <i class='. Further the HTML is completed by the Suffix. It comes in handy when you need to (for example) add a div element also for the navigation menu then you will set its value to: <div class="someThing"><i class=".

  • suffix: To complete the HTML Suffix should be provided. Following the above example, the suffix will be: "></i>.

  • line_end: Following the example, Line End plays a role when you need to end the </div> element after the Link text ends, else it can be left blank and the div can be ended in the suffix.

Child Settings

Child Settings are also not mandatory to be set. It's an extensive support option as some themes have different classes for their child menu for different styling. Child Settings currently only have an option to set Unordered List Attributes, for example class="" id="".

  • ul_attributes

Release Note

Global settings has been released in v1.6.1 (CHANGELOG)

Global settings gives the option of setting the basic configuration of the rendered menu.

  • method: Method in the Global Settings give you an option to choose how the link coloumn in the menu database is being treated.
    • ROUTE When the method is set to route, Dropmenu will treat the value provided in the link coloumn of a menu item as a route name. So the value will be passed to the route() function to generate a url. This gives you the flexibility during development to update the url in the routes.php without any headace to update the database each and every time.
    • URL The coloumn will be treated as a normal url.

Injecting

Settings can be injected using the same display() function of Dropmenu.

Warning

The Settings injection has been cascaded in the version v1.6.1 (CHANGELOG). The injection method has been changed.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
    // Icon Settings
    $settings['icon']['prefix'] = '<div id="navElement1"><i id="someThing" class="';
    $settings['icon']['suffix'] = '"></i>';
    $settings['icon']['line_end'] = '</div>';

    // Child Settings
    $settings['child']['ul_attributes'] = 'class="nav nav_child"';

    // Global Settings
    $settings['global']['method'] = "ROUTE"; # ROUTE or URL

    Dropmenu::display('admin:nav', $settings);

Sample Output:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
    <ul class="nav nav_parent">
        <li>
            <a href="#someLink">
                <div id="navElement1">
                    <i id="someThing" class="fa fa-cogs"></i>Settings
                </div>
            </a>
        </li>
        <li>
            <ul class="nav nav_child">
                <li>
                    <a href="#someLink">
                        <div id="navElement1">
                            <i id="someThing" class="fa fa-microchip"></i>Chip Settings
                        </div>
                    </a>
                </li>
            </ul>
        </li>
    </ul>

IMPORTANT

Use the available route name set by:

1
    Route::get('some/where', 'SomeController@index')->name('someName');

in the link coloumn if the method is set to ROUTES to avoid unnecessary errors