Skip to content

Instantly share code, notes, and snippets.

@mspacemedia
Created April 27, 2017 13:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mspacemedia/d59b07aafea5d8c1f891d4a0d8d4ecd2 to your computer and use it in GitHub Desktop.
Save mspacemedia/d59b07aafea5d8c1f891d4a0d8d4ecd2 to your computer and use it in GitHub Desktop.
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