diff --git a/src/GraphQL/ObjectGraphQlEx.php b/src/GraphQL/ObjectGraphQlEx.php index 87d91aa..e410850 100644 --- a/src/GraphQL/ObjectGraphQlEx.php +++ b/src/GraphQL/ObjectGraphQlEx.php @@ -62,6 +62,7 @@ class ObjectGraphQlEx extends Extension $curr = Controller::curr(); $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()); } } diff --git a/src/Widgets/BannerWidget.php b/src/Widgets/BannerWidget.php index e0f3db2..4bc1d93 100755 --- a/src/Widgets/BannerWidget.php +++ b/src/Widgets/BannerWidget.php @@ -1,6 +1,5 @@ Image::class, - 'Link' => Link::class, + 'Linked' => Link::class, ]; private static $owns = [ 'Image', - 'Link', + 'Linked', ]; public function getCMSFields() @@ -46,7 +45,7 @@ class BannerWidget extends Widget $fields->push(UploadField::create('Image', 'Image (minimal width 301px)') ->setAllowedFileCategories(['image/supported'])); - $fields->push(LinkField::create('Link', 'Link', $this)); + $fields->push(LinkField::create('Linked', 'Link', $this)); return $fields; } @@ -63,12 +62,12 @@ class BannerWidget extends Widget public function onBeforeWrite() { - $title = $this->getField('Title'); - $img = $this->Image(); - if(!$title && $img) { - $this->setField('Title', $img->getTitle()); - } + $title = $this->getField('Title'); + $img = $this->Image(); + if(!$title && $img) { + $this->setField('Title', $img->getTitle()); + } - parent::onBeforeWrite(); + parent::onBeforeWrite(); } } diff --git a/templates/A2nt/CMSNiceties/Widgets/BannerWidget.ss b/templates/A2nt/CMSNiceties/Widgets/BannerWidget.ss index 67a35c9..f7473bf 100755 --- a/templates/A2nt/CMSNiceties/Widgets/BannerWidget.ss +++ b/templates/A2nt/CMSNiceties/Widgets/BannerWidget.ss @@ -1,8 +1,8 @@ $Title -<% if $Link %> - <% with $Link %> - target="_blank"<% end_if %> class="stretched-link"> - $Up.Title +<% if $Linked %> + <% with $Linked %> + target="_blank"<% end_if %> class="stretched-link"> + $Title <% end_with %> <% end_if %>