Skip to content

Commit

Permalink
...
Browse files Browse the repository at this point in the history
  • Loading branch information
[email protected] authored and [email protected] committed Jul 17, 2023
1 parent a0c26dc commit ff97853
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions src/Extensions/ElementContentExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,15 @@ public function updateCMSFields(FieldList $fields): FieldList
CheckboxField::create('TextCenter', 'Zentriert?')
->setDescription('Soll der Inhalt zentriert ausgegeben werden?'),
HTMLEditorField::create('SecondContent', 'Zweiter Inhalt'),
TextField::create('ButtonCaption', 'Button Beschriftung')
->setDescription('Wenn nicht gepflegt wird "Mehr erfahren" ausgegeben.'),
TreeDropdownField::create('LinkedPageID', 'Interne Verlinkung', SiteTree::class)
->setDescription('Wird bevorzugt ausgegeben.'),
TextField::create('ExternalLink', 'Externe Verlinkung')
->setDescription('Muss mit "https://" gepflegt werden.<br>Wird alternativ zur internen Verlinkung ausgegeben.'),
]);

$fields->insertAfter('Content', TextField::create('ButtonCaption', 'Button Beschriftung')
->setDescription('Wenn nicht gepflegt wird "Mehr erfahren" ausgegeben.'));
$fields->insertAfter('Content', TreeDropdownField::create('LinkedPageID', 'Interne Verlinkung', SiteTree::class)
->setDescription('Wird bevorzugt ausgegeben.'));
$fields->insertAfter('Content', TextField::create('ExternalLink', 'Externe Verlinkung')
->setDescription('Muss mit "https://" gepflegt werden.<br>Wird alternativ zur internen Verlinkung ausgegeben.'));

/*Define all fields for media settings*/
if($this->getConfigVariable('Layouts', $this->owner->ElementStyle)['hasMedia']){
$fields->addFieldsToTab('Root.Medien', [
Expand Down Expand Up @@ -164,13 +165,11 @@ public function updateCMSFields(FieldList $fields): FieldList
/*As long as no Layout is selected, all Fields will be removed*/
$fields->removeByName($field);
if (!$fields->dataFieldByName($field)) {
$fields->removeByName($field);
$field = str_replace('ID', '', $field);
$fields->removeByName($field);
}
} else {
if (!$this->getConfigVariable('Layouts', $this->owner->ElementStyle)['FieldsVisible'][$field]) {
$fields->removeByName($field);
$field = str_replace('ID', '', $field);
$fields->removeByName($field);
}
Expand Down Expand Up @@ -229,7 +228,7 @@ private function getReservedFields(): array
public function HTML(){
return $this->owner->Content;
}

public function ButtonCaption(){
if($this->owner->ButtonCaption != ''){
return $this->owner->ButtonCaption;
Expand Down

0 comments on commit ff97853

Please sign in to comment.