Created
April 27, 2017 13:02
-
-
Save mspacemedia/d59b07aafea5d8c1f891d4a0d8d4ecd2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class NewsletterExtension extends DataExtension { | |
private static $media_upload_folder = "properties"; | |
/** | |
* List of database fields. {@link DataObject::$db} | |
* | |
* @var array | |
*/ | |
private static $db = array( | |
'EmailPropertyType' => "Enum('Sales, Lettings, Both', 'Sales')", | |
'EmailType' => "Enum('Single Property, All Properties, Message', 'Single Property')" | |
); | |
/** | |
* Return extra fields | |
*/ | |
public function updateCMSFields(FieldList $fields) { | |
switch ($this->owner->EmailType){ | |
case "Single Property": | |
$properties = $this->ZooplaPropertyList(); | |
$fields->push(DropdownField::create('PropertyField', 'Choose Property', $properties->map('listing_id', 'titleField'))); | |
break; | |
case "All Properties": | |
$properties = $this->ZooplaPropertyList(); | |
$fields->push(CheckboxSetField::create('PropertyField', 'Choose Property', $properties->map('listing_id', 'titleField'))); | |
break; | |
default: | |
break; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment