FIX: minor issues

This commit is contained in:
Tony Air 2023-10-31 02:06:10 +02:00
parent cced355f31
commit e9883d1d34
3 changed files with 15 additions and 15 deletions

View File

@ -62,6 +62,7 @@ class ObjectGraphQlEx extends Extension
$curr = Controller::curr(); $curr = Controller::curr();
$req = $curr->getRequest(); $req = $curr->getRequest();
return $req->requestVar('SecurityID') || $req->httpMethod() === 'POST'; // TODO: GraphQL form response /element/*id*/action
return $req->requestVar('SecurityID') || $req->httpMethod() === 'POST' || preg_match('!element/([0-9]+)/([A-z]+)!', $req->getURL());
} }
} }

View File

@ -1,6 +1,5 @@
<?php <?php
namespace A2nt\CMSNiceties\Widgets; namespace A2nt\CMSNiceties\Widgets;
use gorriecoe\Link\Models\Link; use gorriecoe\Link\Models\Link;
@ -31,12 +30,12 @@ class BannerWidget extends Widget
private static $has_one = [ private static $has_one = [
'Image' => Image::class, 'Image' => Image::class,
'Link' => Link::class, 'Linked' => Link::class,
]; ];
private static $owns = [ private static $owns = [
'Image', 'Image',
'Link', 'Linked',
]; ];
public function getCMSFields() public function getCMSFields()
@ -46,7 +45,7 @@ class BannerWidget extends Widget
$fields->push(UploadField::create('Image', 'Image (minimal width 301px)') $fields->push(UploadField::create('Image', 'Image (minimal width 301px)')
->setAllowedFileCategories(['image/supported'])); ->setAllowedFileCategories(['image/supported']));
$fields->push(LinkField::create('Link', 'Link', $this)); $fields->push(LinkField::create('Linked', 'Link', $this));
return $fields; return $fields;
} }

View File

@ -1,8 +1,8 @@
<img src="$Image.FocusFill(432,315).URL" alt="$Title" /> <img src="$Image.FocusFill(432,315).URL" alt="$Title" />
<% if $Link %> <% if $Linked %>
<% with $Link %> <% with $Linked %>
<a href="$URL"<% if $OpenInNewWindow %> target="_blank"<% end_if %> class="stretched-link"> <a href="$LinkURL"<% if $OpenInNewWindow %> target="_blank"<% end_if %> class="stretched-link">
<span class="visually-hidden">$Up.Title</span> <span class="visually-hidden">$Title</span>
</a> </a>
<% end_with %> <% end_with %>
<% end_if %> <% end_if %>