FIX: Replace link field

This commit is contained in:
Tony Air 2022-07-02 18:29:25 +02:00
parent 936bca73e9
commit eba6c75251
7 changed files with 30 additions and 30 deletions

View File

@ -8,8 +8,6 @@
namespace A2nt\CMSNiceties\Extensions; namespace A2nt\CMSNiceties\Extensions;
use Sheadawson\Linkable\Forms\LinkField;
use Sheadawson\Linkable\Models\Link;
use SilverStripe\Control\HTTPResponse; use SilverStripe\Control\HTTPResponse;
use SilverStripe\Forms\FieldList; use SilverStripe\Forms\FieldList;
use SilverStripe\Forms\TextField; use SilverStripe\Forms\TextField;

View File

@ -4,8 +4,6 @@ namespace A2nt\CMSNiceties\Extensions;
use Dynamic\Elements\Blog\Elements\ElementBlogPosts; use Dynamic\Elements\Blog\Elements\ElementBlogPosts;
use Innoweb\Sitemap\Pages\SitemapPage; use Innoweb\Sitemap\Pages\SitemapPage;
use Sheadawson\Linkable\Forms\LinkField;
use Sheadawson\Linkable\Models\Link;
use SilverStripe\AssetAdmin\Forms\UploadField; use SilverStripe\AssetAdmin\Forms\UploadField;
use SilverStripe\Assets\Image; use SilverStripe\Assets\Image;
use SilverStripe\Forms\CheckboxField; use SilverStripe\Forms\CheckboxField;

View File

@ -8,8 +8,8 @@
namespace A2nt\CMSNiceties\Extensions; namespace A2nt\CMSNiceties\Extensions;
use Sheadawson\Linkable\Forms\LinkField; use gorriecoe\Link\Models\Link;
use Sheadawson\Linkable\Models\Link; use gorriecoe\LinkField\LinkField;
use SilverStripe\Forms\FieldList; use SilverStripe\Forms\FieldList;
use SilverStripe\Forms\TextField; use SilverStripe\Forms\TextField;
use SilverStripe\ORM\DataExtension; use SilverStripe\ORM\DataExtension;
@ -57,26 +57,34 @@ class SocialExtension extends DataExtension
{ {
parent::updateCMSFields($fields); parent::updateCMSFields($fields);
$linkFields = [ $cfg = [
LinkField::create('FacebookID', 'Facebook'), 'types' => [
LinkField::create('LinkedInID', 'LinkedIn'), 'URL',
LinkField::create('PinterestID', 'Pinterest'), ],
LinkField::create('InstagramID', 'Instagram'),
LinkField::create('TwitterID', 'Twitter'),
LinkField::create('YouTubeID', 'YouTube'),
]; ];
foreach ($linkFields as $field) { $linkFields = [
$field->setAllowedTypes(['URL']); LinkField::create('Facebook', 'Facebook', $this->owner, $cfg),
} LinkField::create('LinkedIn', 'LinkedIn', $this->owner, $cfg),
LinkField::create('Pinterest', 'Pinterest', $this->owner, $cfg),
LinkField::create('Instagram', 'Instagram', $this->owner, $cfg),
LinkField::create('Twitter', 'Twitter', $this->owner, $cfg),
LinkField::create('YouTube', 'YouTube', $this->owner, $cfg),
];
$fields->findOrMakeTab('Root.Social'); $fields->findOrMakeTab('Root.Social');
$fields->addFieldsToTab('Root.Social', [ $fields->addFieldsToTab('Root.Social', [
LinkField::create('PublicEmailID', 'Public Email') LinkField::create('PublicEmail', 'Public Email', $this->owner, [
->setAllowedTypes(['Email']), 'types' => [
LinkField::create('PhoneNumberID', 'Phone Number') 'Email',
->setAllowedTypes(['Phone']), ],
]),
LinkField::create('PhoneNumber', 'Phone Number', $this->owner, [
'types' => [
'Phone',
],
]),
]); ]);
$fields->addFieldsToTab('Root.Social', $linkFields); $fields->addFieldsToTab('Root.Social', $linkFields);

View File

@ -9,8 +9,6 @@
namespace A2nt\CMSNiceties\Models; namespace A2nt\CMSNiceties\Models;
use Dynamic\FlexSlider\Model\SlideImage; use Dynamic\FlexSlider\Model\SlideImage;
use Sheadawson\Linkable\Forms\LinkField;
use Sheadawson\Linkable\Models\Link;
use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DataObject;
use SilverStripe\ORM\ValidationResult; use SilverStripe\ORM\ValidationResult;
use SilverStripe\SiteConfig\SiteConfig; use SilverStripe\SiteConfig\SiteConfig;

View File

@ -8,8 +8,8 @@
namespace A2nt\CMSNiceties\Models; namespace A2nt\CMSNiceties\Models;
use Sheadawson\Linkable\Forms\LinkField; use gorriecoe\Link\Models\Link;
use Sheadawson\Linkable\Models\Link; use gorriecoe\LinkField\LinkField;
use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DataObject;
use SilverStripe\ORM\ValidationResult; use SilverStripe\ORM\ValidationResult;
use SilverStripe\SiteConfig\SiteConfig; use SilverStripe\SiteConfig\SiteConfig;
@ -63,7 +63,7 @@ class Notification extends DataObject
$fields = parent::getCMSFields(); $fields = parent::getCMSFields();
$fields->addFieldsToTab('Root.Main', [ $fields->addFieldsToTab('Root.Main', [
LinkField::create('TargetLinkID', 'Link'), LinkField::create('TargetLink', 'Link', $this),
]); ]);
return $fields; return $fields;

View File

@ -3,8 +3,8 @@
namespace A2nt\CMSNiceties\Widgets; namespace A2nt\CMSNiceties\Widgets;
use Sheadawson\Linkable\Forms\LinkField; use gorriecoe\Link\Models\Link;
use Sheadawson\Linkable\Models\Link; use gorriecoe\LinkField\LinkField;
use SilverStripe\AssetAdmin\Forms\UploadField; use SilverStripe\AssetAdmin\Forms\UploadField;
use SilverStripe\Assets\Image; use SilverStripe\Assets\Image;
use SilverStripe\Widgets\Model\Widget; use SilverStripe\Widgets\Model\Widget;
@ -46,7 +46,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('LinkID', 'Link')); $fields->push(LinkField::create('Link', 'Link', $this));
return $fields; return $fields;
} }

View File

@ -3,8 +3,6 @@
namespace A2nt\CMSNiceties\Widgets; namespace A2nt\CMSNiceties\Widgets;
use Sheadawson\Linkable\Forms\LinkField;
use Sheadawson\Linkable\Models\Link;
use SilverStripe\AssetAdmin\Forms\UploadField; use SilverStripe\AssetAdmin\Forms\UploadField;
use SilverStripe\Assets\Image; use SilverStripe\Assets\Image;
use SilverStripe\Forms\HTMLEditor\HTMLEditorField; use SilverStripe\Forms\HTMLEditor\HTMLEditorField;