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;
use Sheadawson\Linkable\Forms\LinkField;
use Sheadawson\Linkable\Models\Link;
use SilverStripe\Control\HTTPResponse;
use SilverStripe\Forms\FieldList;
use SilverStripe\Forms\TextField;

View File

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

View File

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

View File

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

View File

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

View File

@ -3,8 +3,8 @@
namespace A2nt\CMSNiceties\Widgets;
use Sheadawson\Linkable\Forms\LinkField;
use Sheadawson\Linkable\Models\Link;
use gorriecoe\Link\Models\Link;
use gorriecoe\LinkField\LinkField;
use SilverStripe\AssetAdmin\Forms\UploadField;
use SilverStripe\Assets\Image;
use SilverStripe\Widgets\Model\Widget;
@ -46,7 +46,7 @@ class BannerWidget extends Widget
$fields->push(UploadField::create('Image', 'Image (minimal width 301px)')
->setAllowedFileCategories(['image/supported']));
$fields->push(LinkField::create('LinkID', 'Link'));
$fields->push(LinkField::create('Link', 'Link', $this));
return $fields;
}

View File

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