-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New classes for testing ElementalArea in DataObject
- Loading branch information
Sabina Talipova
committed
May 9, 2022
1 parent
da44d50
commit 94420d7
Showing
4 changed files
with
65 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php | ||
|
||
namespace SilverStripe\FrameworkTest\Elemental\Admin; | ||
|
||
use SilverStripe\Admin\ModelAdmin; | ||
use SilverStripe\FrameworkTest\Elemental\Model\ElementalBehatTestObject; | ||
|
||
class ElementalBehatTestAdmin extends ModelAdmin | ||
{ | ||
private static string $url_segment = 'elemental-behat-test-admin'; | ||
private static string $menu_title = 'Elemental Behat Test Admin'; | ||
private static string $menu_icon_class = 'font-icon-block-banner'; | ||
|
||
private static array $managed_models = [ | ||
ElementalBehatTestObject::class, | ||
]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php | ||
|
||
namespace SilverStripe\FrameworkTest\Elemental\Extension; | ||
|
||
use DNADesign\Elemental\Models\ElementalArea; | ||
use SilverStripe\ORM\DataExtension; | ||
|
||
class ElementalBehatTestExtension extends DataExtension | ||
{ | ||
private static $has_one = [ | ||
'ElementalArea' => ElementalArea::class, | ||
]; | ||
|
||
private static $owns = ['ElementalArea']; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
namespace SilverStripe\FrameworkTest\Elemental\Model; | ||
|
||
use SilverStripe\FrameworkTest\Elemental\Admin\ElementalBehatTestAdmin; | ||
use SilverStripe\Control\Controller; | ||
use SilverStripe\ORM\DataObject; | ||
|
||
class ElementalBehatTestObject extends DataObject | ||
{ | ||
private static string $table_name = 'ElementalBehatTestObject'; | ||
|
||
public function CMSEditLink() | ||
{ | ||
$admin = ElementalBehatTestAdmin::singleton(); | ||
$sanitisedClassname = str_replace('\\', '-', $this->ClassName); | ||
|
||
return Controller::join_links( | ||
$admin->Link($sanitisedClassname), | ||
'EditForm/field/', | ||
$sanitisedClassname, | ||
'item', | ||
$this->ID, | ||
); | ||
} | ||
} |