PHP code example of hasanart / moco-framework

1. Go to this page and download the library: Download hasanart/moco-framework 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/ */

    

hasanart / moco-framework example snippets






use MocoFramework\Helper\Controls;


//use Globa Variable
global $moco_framework;


// set your Tabs & option Controls
$options = [        
    //tabs
    [
        'id'        => 'general',
        'title'     => 'General',
        'icon'      => 'fa-dashboard',
        'controls'    => [
            [
                'id'     => 'Text Control',
                'type'      => Controls::Text,
                'title'     => 'wordpress test',
                'desc'     => 'wordpress test test',
                'placeholder'     => 'wordpress ...',
                'default'     => 'wordpress ...',
                'detail'     => 'wordpress detail'
            ],
            [
                'id'        => 'js',
                'type'      => Controls::CodeEditor,
                'title'     => 'codeEditor',
            ],
            [

                'id'        => 'wp_editor',
                'type'      => Controls::WpEditor,
                'title'     => 'Wp Editor',
                'default'   => 'defaul content with support html',
            ]
        ]
    ],
    //external tab link ()
    [
        'id'        => 'external',
        'title'     => 'External',
        'icon'      => 'fa-external',
        'link'      => 'https://wpdev.ir/',
    ]
];

//make new option page 
$moco_framework->option()
	->setTitle('Moco Framework Options')
	->setSubTitle('the best of options package')
	->setMenu('Moco Options')
	->setSlug('moco-options')
	->setPosition(99)
	->options($options);


use MocoFramework\Helper\Controls;


//use Globa Variable
global $moco_framework;


// set your Tabs & option Controls
$options = [        
    //tabs
    [
        'id'        => 'general',
        'title'     => 'General',
        'icon'      => 'fa-dashboard',
        'submenu'    => [
            [
                'id'        => 'subGeneral',
                'title'     => 'Sub General',
                'icon'      => 'fa-dashboard',
                'controls'    => [
                    [
                        'id'     => 'Text Control',
                        'type'      => Controls::Text,
                        'title'     => 'wordpress test',
                        'desc'     => 'wordpress test test',
                        'placeholder'     => 'wordpress ...',
                        'default'     => 'wordpress ...',
                        'detail'     => 'wordpress detail'
                    ],
                    [
                        'id'        => 'js',
                        'type'      => Controls::CodeEditor,
                        'title'     => 'codeEditor',
                    ],
                    [
        
                        'id'        => 'wp_editor',
                        'type'      => Controls::WpEditor,
                        'title'     => 'Wp Editor',
                        'default'   => 'defaul content with support html',
                    ]
                ]
            ],
        ]
    ],
    //external tab link ()
    [
        'id'        => 'external',
        'title'     => 'External',
        'icon'      => 'fa-external',
        'link'      => 'https://wpdev.ir/',
    ]
];

//make new option page 
$moco_framework->option()
	->setTitle('Moco Framework Options')
	->setSubTitle('the best of options package')
	->setMenu('Moco Options')
	->setSlug('moco-options')
	->setPosition(99)
	->options($options);


global $moco_framework;
$moco_framework->getOption('moco-options', 'logo','defautl logo url' );

function get_moco($option, $default = false){
    global $moco_framework;
    return $moco_framework->getOption('moco-options', $option, $default );
}