PHP code example of clesson-de / silverstripe-dashboard
1. Go to this page and download the library: Download clesson-de/silverstripe-dashboard 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/ */
clesson-de / silverstripe-dashboard example snippets
use Clesson\Silverstripe\Dashboard\Forms\DashboardField;
public function getCMSFields(): FieldList
{
$fields = parent::getCMSFields();
/** @var DashboardField $dashboardField */
$dashboardField = DashboardField::create('Dashboard', 'my-dashboard-key');
$fields->addFieldToTab('Root.Dashboard', $dashboardField);
return $fields;
}
declare(strict_types=1);
namespace App\Panels;
use Clesson\Silverstripe\Dashboard\Panels\DashboardPanel;
use SilverStripe\Control\Director;
class RecentOrdersPanel extends DashboardPanel
{
public function getTitle(): string
{
return _t(__CLASS__ . '.TITLE', 'Recent Orders');
}
public function getResourceURL(): string
{
return Director::absoluteURL('api/recent-orders');
}
public function getDefaultWidth(): string
{
return 'double';
}
public function getDefaultRefreshInterval(): int
{
return 60; // Refresh every 60 seconds
}
}
public function getCSS(): ?string
{
return 'my-module: client/admin/dist/panel.css';
}
public function getJavaScript(): ?string
{
return 'my-module: client/admin/dist/panel.js';
}
/dev/build?flush=all
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.