Skip to content

Commit

Permalink
Merge pull request #6 from muskie9/pull/simplify
Browse files Browse the repository at this point in the history
UPDATE allow recursion to be disabled via config
  • Loading branch information
muskie9 authored May 21, 2019
2 parents a15cb46 + e42938d commit fc3c1cf
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/Page/EventPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,13 @@ class EventPage extends \Page
*/
private static $can_be_root = false;

/**
* Recursion is currently experimental.
*
* @var bool
*/
private static $recursion = false;

/**
* @var array
*/
Expand Down Expand Up @@ -245,15 +252,15 @@ public function getCMSFields()

$end->hideIf('AllDay')->isEqualTo(true)->end();

if ($this->StartDatetime) {
if ($this->StartDatetime && $this->config()->get('recursion')) {
$allDayGroup->push(
$recursion = DropdownField::create('Recursion')
->setSource($this->getPatternSource())
->setEmptyString('Does not repeat')
);
}

if ($this->Recursion) {
if ($this->Recursion && $this->config()->get('recursion')) {
if ($this->isCopy()) {
$allDayGroup->performReadonlyTransformation();
} else {
Expand Down Expand Up @@ -282,6 +289,10 @@ public function getCMSFields()
$fields = $fields->makeReadonly();
}

if (!$this->config()->get('recursion')) {
$fields->removeByName('RecurringEvents');
}

return $fields;
}

Expand Down

0 comments on commit fc3c1cf

Please sign in to comment.