Skip to content

Commit

Permalink
Add configuration to allow not replacing the 'Content' field to enabl…
Browse files Browse the repository at this point in the history
…e backwards compatibility with older content blocks modules.
  • Loading branch information
ichaber authored and Dylan Wagstaff committed Sep 19, 2019
1 parent a3c1b11 commit cd7dd78
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/Extensions/ElementalAreasExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,14 @@ class ElementalAreasExtension extends DataExtension
*/
private static $sort_types_alphabetically = true;

/**
* Whether or not to replace the default SiteTree content field
*
* @var boolean
* @config
*/
private static $replace_content_field = true;

/**
* Get the available element types for this page type,
*
Expand Down Expand Up @@ -170,7 +178,9 @@ public function updateCMSFields(FieldList $fields)

// add an empty holder for content as some module explicitly use insert
// after content.
$fields->replaceField('Content', new LiteralField('Content', ''));
if (Config::inst()->get(ElementalAreasExtension::class, 'replace_content_field')) {
$fields->replaceField('Content', new LiteralField('Content', ''));
}
$elementalAreaRelations = $this->owner->getElementalRelations();

foreach ($elementalAreaRelations as $eaRelationship) {
Expand Down

0 comments on commit cd7dd78

Please sign in to comment.