Skip to content

Commit

Permalink
refactor - tweak default values for Slider settings (#146)
Browse files Browse the repository at this point in the history
Use DirectionNav vs. ControlNav in carousel and thumbnail carousel
  • Loading branch information
jsirish authored Sep 24, 2018
1 parent 7491577 commit 9cc9049
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/FlexSlider.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public function populateDefaults()
parent::populateDefaults();
$this->owner->Loop = 1;
$this->owner->Animate = 1;
$this->owner->SliderControlNav = 1;
$this->owner->SliderControlNav = 0;
$this->owner->SliderDirectionNav = 1;
$this->owner->CarouselControlNav = 0;
$this->owner->CarouselDirectionNav = 1;
Expand Down
2 changes: 0 additions & 2 deletions tasks/SlidePublishTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,8 @@ public function publishSlides()
if (!$slide->Name) {
$slide->Name = "No Name";
}
$title = $slide->Name;
$slide->writeToStage('Stage');
$slide->publishRecursive();
static::write_message($slide->Name . " updated");
++$ct;
}
}
Expand Down
17 changes: 15 additions & 2 deletions tasks/SlideThumbnailNavMigrationTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Dynamic\FlexSlider\ORM\FlexSlider;
use SilverStripe\CMS\Model\SiteTree;
use SilverStripe\Control\Director;
use SilverStripe\Core\ClassInfo;
use SilverStripe\Dev\BuildTask;
use SilverStripe\ORM\DataObject;
Expand Down Expand Up @@ -65,7 +66,7 @@ public function defaultSliderSettings()
foreach ($this->getObjectSet($object) as $result) {
$result->Loop = 1;
$result->Animate = 1;
$result->SliderControlNav = 1;
$result->SliderControlNav = 0;
$result->SliderDirectionNav = 1;
$result->CarouselControlNav = 0;
$result->CarouselDirectionNav = 1;
Expand All @@ -83,6 +84,18 @@ public function defaultSliderSettings()
}
}
}
echo '<p>'.$ct.' Sliders updated.</p>';
static::write_message($ct . " Sliders updated");
}

/**
* @param $message
*/
protected static function write_message($message)
{
if (Director::is_cli()) {
echo "{$message}\n";
} else {
echo "{$message}<br><br>";
}
}
}

0 comments on commit 9cc9049

Please sign in to comment.