PHP code example of amalranganath / a-demo-plugin

1. Go to this page and download the library: Download amalranganath/a-demo-plugin library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

amalranganath / a-demo-plugin example snippets


return [
    'id' => 'plugin-id',
    'name' => 'Plugin Name',

     /**  Do not change **/
    'basePath' => plugin_dir_path(__FILE__), 
    'baseUrl' => plugins_url('/', __FILE__),
    'baseName' => plugin_basename(__FILE__),
    
    'i18n' => 'language-domain-name',

    /** Admin menu and pages of the plugin **/
    'admin' => [
        'class' => 'Admin controller class name',

        /** Main menu item **/
        'mainMenu' => [
            'pageTitle' => 'The Page title',
            'title' => 'The menu title',
            'slug' => 'main-menu-slug',
            'icon' => 'The menu icon class',
            'position' => 'The menu item position'
        ],

        /** Sub menu items **/
        'pages' => [
            'menu-item-1' => [
                'pageTitle' => 'The Page title',
                'title' => 'The menu title',
                'slug' => 'menu-item-1-slug',
                /** The tabs **/
                'tabs' => [
                    'tab-1-slug' => 'tab 1 Title',
                    'tab-2-slug' => 'tab 2 Title',
                ]
            ],
            'menu-item-2' => [
                'pageTitle' => 'The Page title',
                'title' => 'The menu item 2 title',
                'slug' => 'menu-item-2-slug',
            ]
        ]
];