Skip to content

Commit

Permalink
Fix up Linkable
Browse files Browse the repository at this point in the history
  • Loading branch information
altwohill committed Mar 22, 2018
1 parent 65edad9 commit 4f2e007
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions src/SlideImage.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Twohill\Carousel\Model;

use Sheadawson\Linkable\Forms\LinkField;
use SilverStripe\AssetAdmin\Forms\UploadField;
use SilverStripe\Assets\Image;
use SilverStripe\ORM\DataObject;
Expand Down Expand Up @@ -68,9 +69,9 @@ class SlideImage extends DataObject implements PermissionProvider

/**
* Adds Publish button to SlideImage record
*
* @var bool
*/
*
* @var bool
*/
private static $versioned_gridfield_extensions = true;

/**
Expand Down Expand Up @@ -106,6 +107,7 @@ public function getCMSFields()
'SortOrder',
'PageID',
'Image',
'LinkId'
]);

// Title
Expand All @@ -126,11 +128,6 @@ public function getCMSFields()
_t(__CLASS__ . '.USED_IN_TEMPLATE', 'optional, used in template')
);

// Page link
$fields->dataFieldByName('LinkID')
->setTitle(
_t(__CLASS__ . '.PAGE_LINK', "Optional link")
);

// Image
$image = UploadField::create(
Expand All @@ -140,7 +137,11 @@ public function getCMSFields()

$image->getValidator()->setAllowedExtensions(['jpg', 'jpeg', 'png', 'gif']);

$fields->insertAfter($image, 'Text');
$fields->insertBefore($image, 'Title');
$fields->insertAfter(
'Text',
LinkField::create('LinkID', _t(__CLASS__ . '.PAGE_LINK', "Optional link"))
);

$this->extend('updateSlideImageFields', $fields);

Expand Down

0 comments on commit 4f2e007

Please sign in to comment.