-
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 6, 2022
1 parent
da44d50
commit 8e2697a
Showing
4 changed files
with
63 additions
and
0 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,26 @@ | ||
<?php | ||
|
||
namespace SilverStripe\FrameworkTest\Model; | ||
|
||
use SilverStripe\FrameworkTest\Admin\TestBlogPostsAdmin; | ||
use SilverStripe\Control\Controller; | ||
use SilverStripe\ORM\DataObject; | ||
|
||
class TestBlogPost extends DataObject | ||
{ | ||
private static string $table_name = 'TestBlogPost'; | ||
|
||
public function CMSEditLink() | ||
{ | ||
$admin = TestBlogPostsAdmin::singleton(); | ||
$sanitisedClassname = str_replace('\\', '-', $this->ClassName); | ||
|
||
return Controller::join_links( | ||
$admin->Link($sanitisedClassname), | ||
'EditForm/field/', | ||
$sanitisedClassname, | ||
'item', | ||
$this->ID, | ||
); | ||
} | ||
} |
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\Extension; | ||
|
||
use DNADesign\Elemental\Models\ElementalArea; | ||
use SilverStripe\ORM\DataExtension; | ||
|
||
class TestBlogPostExtension 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,17 @@ | ||
<?php | ||
|
||
namespace SilverStripe\FrameworkTest\Admin; | ||
|
||
use SilverStripe\Admin\ModelAdmin; | ||
use SilverStripe\FrameworkTest\Model\TestBlogPost; | ||
|
||
class TestBlogPostsAdmin extends ModelAdmin | ||
{ | ||
private static string $url_segment = 'test-blog-posts-admin'; | ||
private static string $menu_title = 'Blog Posts'; | ||
private static string $menu_icon_class = 'font-icon-block-banner'; | ||
|
||
private static array $managed_models = [ | ||
TestBlogPost::class, | ||
]; | ||
} |