PHP code example of wdmg / yii2-widgets

1. Go to this page and download the library: Download wdmg/yii2-widgets 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/ */

    

wdmg / yii2-widgets example snippets


    
    use wdmg\widgets\NavContents;
    
    $content = '<h1>Header H1</h1><p>Some text, some text...</p><p>Some text, some text...</p>'
    
    

    
    use wdmg\widgets\MenuContents;
    
    $content = '<h1 id="test-header" class="header">Header H1</h1><p>Some text, some text...</p><p>Some text, some text...</p>'
    
    

    
    use wdmg\widgets\LangSwitcher;
    
    
        echo LangSwitcher::widget([
            'label' => 'Language version',
            'model' => $model,
            'renderWidget' => 'button-group',
            'createRoute' => 'news/create', // string or array
            'updateRoute' => 'news/update', // string or array
            'supportLocales' => $this->context->module->supportLocales,
            'versions' => (isset($model->source_id)) ? $model->getAllVersions($model->source_id, true) : $model->getAllVersions($model->id, true),
            'options' => [
                'id' => 'locale-switcher',
                'class' => 'pull-right'
            ]
        ]);
    

    
    use wdmg\widgets\AliasInput;
    
    <?= $form->field($model, 'alias')->widget(AliasInput::class, [
        'labels' => [
            'edit' => 'Edit',
            'save' => 'Save'
        ],
        'options' => [
            'baseUrl' => $model->url
        ]
    ])->label('Post URL');