Skip to content

Commit

Permalink
NEW Add NonInlineEditableExtension
Browse files Browse the repository at this point in the history
  • Loading branch information
emteknetnz committed May 1, 2024
1 parent 3791f91 commit 6daf6f3
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
2 changes: 1 addition & 1 deletion code/TestRegistryPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use SilverStripe\Security\DefaultAdminService;
use SilverStripe\Security\Member;

if (!class_exists(RegistryPage::class)) {
if (class_exists(RegistryPage::class)) {
class TestRegistryPage extends RegistryPage
{
public function requireDefaultRecords()
Expand Down
7 changes: 6 additions & 1 deletion code/elemental/ElementContentExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace SilverStripe\FrameworkTest\Elemental\Extension;

use SilverStripe\CMS\Model\SiteTree;
use SilverStripe\Core\Extension;
use SilverStripe\Forms\FieldList;
use SilverStripe\ORM\ValidationResult;
Expand All @@ -20,6 +21,10 @@ class ElementContentExtension extends Extension
'MyInt' => 'Int',
];

private static $has_one = [
'MyPage' => SiteTree::class,
];

public function validate(ValidationResult $result)
{
if ($this->owner->Title == 'x') {
Expand All @@ -35,7 +40,7 @@ public function validate(ValidationResult $result)

public function updateCMSCompositeValidator(CompositeValidator $compositeValidator)
{
$compositeValidator->addValidator(new RequiredFields(['Title']));
$compositeValidator->addValidator(new RequiredFields(['Title', 'MyPageID']));
}

public function updateCMSFields(FieldList $fields)
Expand Down
10 changes: 10 additions & 0 deletions code/elemental/NonInlineEditableExtension.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

namespace SilverStripe\FrameworkTest\Elemental\Extension;

use SilverStripe\Core\Extension;

class NonInlineEditableExtension extends Extension
{
private static $inline_editable = false;
}

0 comments on commit 6daf6f3

Please sign in to comment.