FIX: Links Widget

This commit is contained in:
Tony Air 2024-05-06 13:03:31 +02:00
parent 7c9fa8530d
commit fab6c5f8e9

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;
@ -33,12 +32,19 @@ class LinksWidget extends Widget
'Links' => Link::class, 'Links' => Link::class,
]; ];
private static $many_many_extraFields = [
'Links' => [
'Sort' => 'Int',
],
];
private static $owns = [ private static $owns = [
'Links', 'Links',
]; ];
public function getCMSFields() public function getCMSFields()
{ {
//die('aaa');
$fields = parent::getCMSFields(); $fields = parent::getCMSFields();
if($this->ID) { if($this->ID) {
@ -47,11 +53,13 @@ class LinksWidget extends Widget
'Links', 'Links',
$this $this
)); ));
}else{ } else {
$fields->push(LiteralField::create( $fields->push(
LiteralField::create(
'Note', 'Note',
'<p class="alert alert-warning"><b>Note:</b> The widget needs to be saved before adding a link.' '<p class="alert alert-warning"><b>Note:</b> The widget needs to be saved before adding a link.'
.' Enter the Title and click "+ Create" button at the bottom left corner of the screen</p>') .' Enter the Title and click "+ Create" button at the bottom left corner of the screen</p>'
)
); );
} }