Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMS 6 Support #31

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 23 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,31 @@
"CMS"
],
"require": {
"jonom/focuspoint": "^5",
"silverstripe/linkfield":"^4.0",
"silverstripe/recipe-cms": "^5.0",
"symbiote/silverstripe-gridfieldextensions": "^4"
"silverstripe/linkfield":"^5.0",
"silverstripe/recipe-cms": "6.x-dev",
"symbiote/silverstripe-gridfieldextensions": "^5",
"jonom/focuspoint": "dev-silverstripe6",
"unclecheese/display-logic": "dev-silverstripe6"
},
"require-dev": {
"dnadesign/silverstripe-elemental": "^5",
"silverstripe/recipe-testing": "^3",
"squizlabs/php_codesniffer": "^3.7"
"dnadesign/silverstripe-elemental": "6.x-dev",
"phpunit/phpunit": "^11.3",
"squizlabs/php_codesniffer": "^3.7",
"silverstripe/versioned": "^3",
"silverstripe/standards": "^1",
"phpstan/extension-installer": "^1.3",
"silverstripe/frameworktest": "^2"
},
"repositories": [
{
"type": "vcs",
"url": "[email protected]:muskie9/silverstripe-focuspoint.git"
},
{
"type": "vcs",
"url": "[email protected]:dynamic/silverstripe-display-logic.git"
}
],
"minimum-stability": "dev",
"prefer-stable": true,
"autoload": {
Expand All @@ -28,7 +43,7 @@
},
"extra": {
"branch-alias": {
"dev-main": "2.x-dev"
"dev-main": "3.x-dev"
}
}
}
9 changes: 6 additions & 3 deletions src/Extension/CarouselPageExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

namespace Dynamic\Carousel\Extension;

use SilverStripe\Core\Extension;
use SilverStripe\ORM\ManyManyList;
use SilverStripe\View\SSViewer;
use Dynamic\Carousel\Model\Slide;
use SilverStripe\Forms\FieldList;
use SilverStripe\ORM\DataExtension;
use SilverStripe\Forms\NumericField;
use SilverStripe\Forms\DropdownField;
use SilverStripe\Forms\CompositeField;
Expand All @@ -29,7 +30,7 @@
* @property int $Interval
* @method ManyManyList|Slide[] Slides()
*/
class CarouselPageExtension extends DataExtension
class CarouselPageExtension extends Extension
{
/**
* @var array
Expand All @@ -48,7 +49,7 @@ class CarouselPageExtension extends DataExtension
* @config
*/
private static $many_many = [
'Slides' => 'Dynamic\\Carousel\\Model\\Slide',
'Slides' => Slide::class,
];

/**
Expand Down Expand Up @@ -76,6 +77,8 @@ class CarouselPageExtension extends DataExtension
public function updateCMSFields(\SilverStripe\Forms\FieldList $fields)
{
if ($this->getOwner()->exists()) {
$fields->removeByName('Slides');

$grid = GridField::create(
'Slides',
'Slides',
Expand Down
7 changes: 6 additions & 1 deletion src/Model/VideoSlide.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class VideoSlide extends Slide
*/
private static $db = [
'VideoType' => 'Enum(["Embed","Native"], "Embed")',
'VideoURL' => 'Varchar(255)',
];

/**
Expand All @@ -56,7 +57,11 @@ class VideoSlide extends Slide
public function getCMSFields(): FieldList
{
$this->beforeUpdateCMSFields(function (FieldList $fields) {
//$fields->
$native = $fields->dataFieldByName('Video');
$embed = $fields->dataFieldByName('VideoURL');

$native->displayIf('VideoType')->isEqualTo('Native')->end();
$embed->displayIf('VideoType')->isEqualTo('Embed')->end();
});

return parent::getCMSFields();
Expand Down
Loading