mirror of
https://github.com/silverstripe/silverstripe-frameworktest
synced 2024-10-22 11:06:02 +02:00
Merge pull request #193 from creative-commoners/pulls/1/elemental-multi
NEW Add ElementalAreasPageExtension
This commit is contained in:
commit
9aada4af47
22
code/elemental/MultiElementalAreasExtension.php
Normal file
22
code/elemental/MultiElementalAreasExtension.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace SilverStripe\FrameworkTest\Elemental\Extension;
|
||||
|
||||
use DNADesign\Elemental\Extensions\ElementalAreasExtension;
|
||||
use DNADesign\Elemental\Models\ElementalArea;
|
||||
|
||||
/**
|
||||
* This is used to test multiple elemental areas on a page
|
||||
*/
|
||||
class MultiElementalAreasExtension extends ElementalAreasExtension
|
||||
{
|
||||
private static $has_one = [
|
||||
'ElementalArea1' => ElementalArea::class,
|
||||
'ElementalArea2' => ElementalArea::class
|
||||
];
|
||||
|
||||
private static $owns = [
|
||||
'ElementalArea1',
|
||||
'ElementalArea2'
|
||||
];
|
||||
}
|
22
code/elemental/MultiElementalBehatTestAdmin.php
Normal file
22
code/elemental/MultiElementalBehatTestAdmin.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace SilverStripe\FrameworkTest\Elemental\Admin;
|
||||
|
||||
use SilverStripe\Admin\ModelAdmin;
|
||||
use SilverStripe\FrameworkTest\Elemental\Model\MultiElementalBehatTestObject;
|
||||
|
||||
class MutliElementalBehatTestAdmin extends ModelAdmin
|
||||
{
|
||||
private static $url_segment = 'multi-elemental-behat-test-admin';
|
||||
|
||||
private static $menu_title = 'Multi-elemental Behat Test Admin';
|
||||
|
||||
private static $menu_icon_class = 'font-icon-block-banner';
|
||||
|
||||
private static $managed_models = [
|
||||
MultiElementalBehatTestObject::class,
|
||||
];
|
||||
|
||||
private static $required_permission_codes = 'CMS_ACCESS_CMSMain';
|
||||
|
||||
}
|
39
code/elemental/MutliElementalBehatTestObject.php
Normal file
39
code/elemental/MutliElementalBehatTestObject.php
Normal file
@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace SilverStripe\FrameworkTest\Elemental\Model;
|
||||
|
||||
use SilverStripe\ORM\DataObject;
|
||||
use SilverStripe\FrameworkTest\Elemental\Extension\MultiElementalAreasExtension;
|
||||
|
||||
class MultiElementalBehatTestObject extends DataObject
|
||||
{
|
||||
private static $db = [
|
||||
'Title' => 'Varchar',
|
||||
];
|
||||
|
||||
private static $table_name = 'ElementalMultiBehatTestObject';
|
||||
|
||||
private static $extensions = [
|
||||
MultiElementalAreasExtension::class,
|
||||
];
|
||||
|
||||
public function canView($member = null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function canEdit($member = null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function canDelete($member = null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function canCreate($member = null, $context = [])
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user