PHP code example of raffaelj / cockpit-dashboardgrid

1. Go to this page and download the library: Download raffaelj/cockpit-dashboardgrid 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/ */

    

raffaelj / cockpit-dashboardgrid example snippets


$app->on('admin.init', function() {

    if (isset($this['modules']['dashboardgrid'])) {

        $this->on('admin.dashboardgrid.widgets.top', function($areas) {
            $area = 'my-custom-area';
            $this->renderView('path/to/custom/dashboard_area.php', compact('areas', 'area'));
        }, 90); // priority < 100: above, > 100: below addon top area with prio 100

    }

});

<div class="uk-width-medium-1-1" data-area="{{ $area }}">
    <div class="uk-sortable uk-grid uk-grid-gutter uk-grid-width-1-1" data-uk-sortable="{group:'dashboard',animation:false,handleClass:'dashboard-handle'}">
      @if(isset($areas[$area]))
        @foreach($areas[$area] as $widget)
        <div data-widget="{{ $widget['name'] }}">
            <i class="dashboard-handle uk-icon-arrows"></i>
            {{ $widget['content'] }}
        </div>
        @endforeach
      @endif
    </div>
</div>