1. Go to this page and download the library: Download phact-cmf-modules/admin 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/ */
phact-cmf-modules / admin example snippets
class Book extends Model
{
public static function getFields()
{
return [
'name' => [
'class' => CharField::class,
'label' => 'Наименование'
],
];
}
}
class BookAdmin extends Admin
{
public function getSearchColumns()
{
return ['name'];
}
public function getModel()
{
return new Book();
}
public static function getName()
{
return 'Книги';
}
public static function getItemName()
{
return 'Книга';
}
}
class BookAdmin extends Admin
{
...
public function getForm()
{
return new BookAdminForm();
}
...
}
class BookAdmin extends Admin
{
...
public function getForm()
{
return new BookAdminCreateForm();
}
public function getUpdateForm()
{
return new BookAdminUpdateForm();
}
...
}
class ReleaseAdmin extends Admin
{
public static $ownerAttribute = 'book';
public function getSearchColumns()
{
return ['year'];
}
public function getModel()
{
return new Release();
}
public static function getName()
{
return 'Издания';
}
public static function getItemName()
{
return 'Издание';
}
}
class BookAdmin extends Admin
{
...
public function getRelatedAdmins()
{
return [
'releases' => ReleaseAdmin::class
];
}
...
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.