mirror of
https://github.com/a2nt/cms-niceties.git
synced 2024-10-22 11:05:46 +02:00
FIX: minor issues
This commit is contained in:
parent
cced355f31
commit
e9883d1d34
@ -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());
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace A2nt\CMSNiceties\Widgets;
|
||||
|
||||
use gorriecoe\Link\Models\Link;
|
||||
@ -31,12 +30,12 @@ class BannerWidget extends Widget
|
||||
|
||||
private static $has_one = [
|
||||
'Image' => 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();
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
<img src="$Image.FocusFill(432,315).URL" alt="$Title" />
|
||||
<% if $Link %>
|
||||
<% with $Link %>
|
||||
<a href="$URL"<% if $OpenInNewWindow %> target="_blank"<% end_if %> class="stretched-link">
|
||||
<span class="visually-hidden">$Up.Title</span>
|
||||
<% if $Linked %>
|
||||
<% with $Linked %>
|
||||
<a href="$LinkURL"<% if $OpenInNewWindow %> target="_blank"<% end_if %> class="stretched-link">
|
||||
<span class="visually-hidden">$Title</span>
|
||||
</a>
|
||||
<% end_with %>
|
||||
<% end_if %>
|
||||
|
Loading…
Reference in New Issue
Block a user