mirror of
https://github.com/a2nt/cms-niceties.git
synced 2024-06-16 09:01:31 +02:00
Compare commits
4 Commits
69d2ccc023
...
34a0f71edc
Author | SHA1 | Date | |
---|---|---|---|
34a0f71edc | |||
2bbbb541c5 | |||
db5192e2bb | |||
1adfc4ef01 |
|
@ -58,3 +58,7 @@ Page:
|
||||||
- A2nt\CMSNiceties\Models\TeamMember
|
- A2nt\CMSNiceties\Models\TeamMember
|
||||||
extensions:
|
extensions:
|
||||||
- DNADesign\Elemental\Extensions\ElementalPageExtension
|
- DNADesign\Elemental\Extensions\ElementalPageExtension
|
||||||
|
|
||||||
|
SilverStripe\CMS\Model\RedirectorPage:
|
||||||
|
extensions:
|
||||||
|
- A2nt\CMSNiceties\Extensions\RedirectorPageEx
|
||||||
|
|
28
src/Extensions/RedirectorPageEx.php
Normal file
28
src/Extensions/RedirectorPageEx.php
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace A2nt\CMSNiceties\Extensions;
|
||||||
|
|
||||||
|
use SilverStripe\Forms\CheckboxField;
|
||||||
|
use SilverStripe\Forms\FieldList;
|
||||||
|
use SilverStripe\ORM\DataExtension;
|
||||||
|
|
||||||
|
class RedirectorPageEx extends DataExtension
|
||||||
|
{
|
||||||
|
private static $db = [
|
||||||
|
'OpenInNewTab' => 'Boolean(0)',
|
||||||
|
];
|
||||||
|
private static $defaults = [
|
||||||
|
'OpenInNewTab' => 0,
|
||||||
|
];
|
||||||
|
|
||||||
|
public function updateCMSFields(FieldList $fields)
|
||||||
|
{
|
||||||
|
$MainTab = $fields->findOrMakeTab('Root.Main');
|
||||||
|
$MainTab->push(
|
||||||
|
CheckboxField::create(
|
||||||
|
'OpenInNewTab',
|
||||||
|
_t('RedirectorPage.OpenInNewTab', 'Open in new tab')
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,11 +2,11 @@
|
||||||
|
|
||||||
namespace A2nt\CMSNiceties\GraphQL;
|
namespace A2nt\CMSNiceties\GraphQL;
|
||||||
|
|
||||||
use A2nt\CMSNiceties\Templates\DeferredRequirements;
|
use SilverStripe\CMS\Model\RedirectorPage;
|
||||||
use SilverStripe\Control\Controller;
|
use SilverStripe\Control\Controller;
|
||||||
use SilverStripe\GraphQL\Controller as GraphQLController;
|
use SilverStripe\GraphQL\Controller as GraphQLController;
|
||||||
use SilverStripe\Core\Extension;
|
use SilverStripe\Core\Extension;
|
||||||
use SilverStripe\View\Requirements;
|
use SilverStripe\ErrorPage\ErrorPage;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class \A2nt\CMSNiceties\GraphQL\ObjectGraphQlEx
|
* Class \A2nt\CMSNiceties\GraphQL\ObjectGraphQlEx
|
||||||
|
@ -65,4 +65,17 @@ class ObjectGraphQlEx extends Extension
|
||||||
// TODO: GraphQL form response /element/*id*/action
|
// TODO: GraphQL form response /element/*id*/action
|
||||||
return $req->requestVar('SecurityID') || $req->httpMethod() === 'POST' || preg_match('!element/([0-9]+)/([A-z]+)!', $req->getURL());
|
return $req->requestVar('SecurityID') || $req->httpMethod() === 'POST' || preg_match('!element/([0-9]+)/([A-z]+)!', $req->getURL());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function isLegacy()
|
||||||
|
{
|
||||||
|
$object = $this->owner;
|
||||||
|
|
||||||
|
return $object->config()->get('legacy') || in_array(
|
||||||
|
$object->ClassName,
|
||||||
|
[
|
||||||
|
RedirectorPage::class,
|
||||||
|
ErrorPage::class,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,21 +6,21 @@
|
||||||
$ExtraClass
|
$ExtraClass
|
||||||
{$LinkClass}
|
{$LinkClass}
|
||||||
<% if $RedirectionType = 'External' || $ExternalURL || $OpenInNewWindow %>
|
<% if $RedirectionType = 'External' || $ExternalURL || $OpenInNewWindow %>
|
||||||
external
|
legacy
|
||||||
<% end_if %>
|
<% end_if %>
|
||||||
<% if $isCurrent || $isSection %>active <% end_if %>
|
<% if $isCurrent || $isSection %>active<% end_if %>
|
||||||
<% if $isSection %>section<% end_if %>
|
<% if $isSection %>section<% end_if %>
|
||||||
"
|
"
|
||||||
<% if $RedirectionType = 'External' || $OpenInNewWindow %>
|
<% if $OpenInNewWindow %>
|
||||||
rel="noreferrer"
|
rel="noreferrer"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
<% end_if %>
|
<% end_if %>
|
||||||
|
|
||||||
data-text="{$MenuTitle.XML}"
|
data-text="{$MenuTitle.XML}"
|
||||||
>
|
>
|
||||||
<% if $BlockIcon %>
|
<% if $BlockIcon %>
|
||||||
<i class="fa-icon $BlockIcon"></i>
|
<i class="fa-icon $BlockIcon"></i>
|
||||||
<% end_if %>
|
<% end_if %>
|
||||||
$MenuTitle.XML
|
$MenuTitle.XML
|
||||||
<% if $isCurrent || $isSection %><i class="visually-hidden">(current)</i><% end_if %>
|
<% if $isCurrent || $isSection %><i class="visually-hidden">(current)</i><% end_if %>
|
||||||
</a>
|
</a>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user