/**
  * Add a tab with an upload field to the owner.config.images_tab_name or self.config.tab_name tab.
  *
  * @param FieldList $fields
  */
 public function updateCMSFields(FieldList $fields)
 {
     $fields->removeByName(self::FieldName);
     if ($this->showOnCMSForm()) {
         // tab name can be set on the owner config.images_tab_name or use the extensions config.tab_name
         $tabName = $this()->config()->get('images_tab_name') ?: parent::get_config_setting('tab_name');
         $fields->addFieldToTab($tabName, $field = new DisplayLogicWrapper(new SelectUploadField(self::FieldName, $this->getFieldLabel(), $this()->{self::FieldName}())));
         if ($label = $this()->getTranslationForContentType('ImagesLabel')) {
             $field->setTitle($label);
         }
         if ($note = $this()->getTranslationForContentType('ImagesNote')) {
             $field->setRightTitle($note);
         }
     }
 }
Пример #2
0
 public function getCMSFields()
 {
     $fields = $this->scaffoldFormFields(array('includeRelations' => $this->ID > 0, 'tabbed' => true, 'ajaxSafe' => true));
     $types = $this->config()->get('types');
     $i18nTypes = array();
     foreach ($types as $key => $label) {
         $i18nTypes[$key] = _t('Linkable.TYPE' . strtoupper($key), $label);
     }
     $fields->removeByName('SiteTreeID');
     $fields->removeByName('File');
     $fields->dataFieldByName('Title')->setTitle(_t('Linkable.TITLE', 'Title'))->setRightTitle(_t('Linkable.OPTIONALTITLE', 'Optional. Will be auto-generated from link if left blank'));
     $fields->replaceField('Type', DropdownField::create('Type', _t('Linkable.LINKTYPE', 'Link Type'), $i18nTypes)->setEmptyString(' '), 'OpenInNewWindow');
     $fields->addFieldToTab('Root.Main', DisplayLogicWrapper::create(TreeDropdownField::create('FileID', _t('Linkable.FILE', 'File'), 'File', 'ID', 'Title'))->displayIf("Type")->isEqualTo("File")->end());
     $fields->addFieldToTab('Root.Main', DisplayLogicWrapper::create(TreeDropdownField::create('SiteTreeID', _t('Linkable.PAGE', 'Page'), 'SiteTree'))->displayIf("Type")->isEqualTo("SiteTree")->end());
     $fields->addFieldToTab('Root.Main', $newWindow = CheckboxField::create('OpenInNewWindow', _t('Linkable.OPENINNEWWINDOW', 'Open link in a new window')));
     $newWindow->displayIf('Type')->isNotEmpty();
     $fields->dataFieldByName('URL')->displayIf("Type")->isEqualTo("URL");
     $fields->dataFieldByName('Email')->setTitle(_t('Linkable.EMAILADDRESS', 'Email Address'))->displayIf("Type")->isEqualTo("Email");
     if ($this->SiteTreeID && !$this->SiteTree()->isPublished()) {
         $fields->dataFieldByName('SiteTreeID')->setRightTitle(_t('Linkable.DELETEDWARNING', 'Warning: The selected page appears to have been deleted or unpublished. This link may not appear or may be broken in the frontend'));
     }
     $fields->addFieldToTab('Root.Main', $anchor = TextField::create('Anchor', _t('Linkable.ANCHOR', 'Anchor')), 'OpenInNewWindow');
     $anchor->setRightTitle('Include # at the start of your anchor name');
     $anchor->displayIf("Type")->isEqualTo("SiteTree");
     $this->extend('updateCMSFields', $fields);
     return $fields;
 }
 public function getCMSFields()
 {
     if ($this->ID == 0) {
         $categorydropdown = TextField::create('CategoryDisclaimer')->setTitle('Category')->setDisabled(true)->setValue('You can assign a category once you have saved the record for the first time.');
     } else {
         $categories = ListCategory::get()->filter("ListPageID", "{$this->ListPageID}")->sort("Category ASC");
         $map = $categories ? $categories->map('ID', 'Category', 'Please Select') : array();
         if ($map) {
             $categorydropdown = new DropdownField('ListCategoryID', 'Category', $map);
             $categorydropdown->setEmptyString("-- Please Select --");
         } else {
             $categorydropdown = new DropdownField('ListCategoryID', 'Category', $map);
             $categorydropdown->setEmptyString("There are no categories created yet");
         }
     }
     $ImageField = UploadField::create('Photo')->setDescription('(Allowed filetypes: jpg, jpeg, png, gif)');
     $ImageField->folderName = 'ListPage';
     $ImageField->getValidator()->allowedExtensions = array('jpg', 'jpeg', 'gif', 'png');
     $DocumentField = UploadField::create('Resource')->setTitle('Resource/Document')->setDescription('(Allowed filetypes: pdf, doc, docx, txt, ppt, or pptx)');
     $DocumentField->folderName = "ListPage";
     $DocumentField->getValidator()->allowedExtensions = array('pdf', 'doc', 'docx', 'txt', 'ppt', 'pptx');
     $LinkField = TextField::create('Link')->setTitle('Link URL');
     $fields = FieldList::create(TabSet::create('Root'));
     $fields->addFieldsToTab('Root.Main', array($categorydropdown, TextField::create('Title'), OptionSetField::create('LinkType')->setTitle('')->setSource($this->dbObject('LinkType')->enumValues()), TextField::create('Link')->setTitle('Link URL')->displayIf('LinkType')->isEqualTo('Link')->andIf('LinkType')->isNotEqualTo('Resource')->end(), DisplayLogicWrapper::create($DocumentField)->displayIf('LinkType')->isEqualTo('Resource')->andIf('LinkType')->isNotEqualTo('Link')->end(), $ImageField, HTMLEditorField::create('Content')));
     return $fields;
 }
Пример #4
0
 /**
  * CMS Fields
  * @return FieldList
  */
 public function getCMSFields()
 {
     $fields = $this->scaffoldFormFields(array('includeRelations' => $this->ID > 0, 'tabbed' => true, 'ajaxSafe' => true));
     $fields->removeByName('MenuTitle');
     $fields->addFieldsToTab('Root.Main', array(HiddenField::create('UniqueConfigTitle'), TextField::create('AdminTitle', 'Admin title')->setDescription('This field is for adminisration use only and will not display on the site.'), CheckboxField::create('ShowInMenus', 'Show in menus', 0), DisplayLogicWrapper::create(TextField::create('MenuTitle', 'Navigation label'))->displayIf("ShowInMenus")->isChecked()->end()));
     $fields->addFieldsToTab('Root.Settings', array(CheckboxField::create('Public', 'Public', 1)->setDescription('Is this section publicly accessible?.'), DropdownField::create('Style', 'Select a style', $this->ConfigStyles)->setEmptyString('Default')));
     $this->extend('updateCMSFields', $fields);
     return $fields;
 }
 /**
  * @param UploadField|\DisplayLogicWrapper $field
  * @param string                           $configVarName - allow you to switch config to check e.g. 'allowed_video_files'
  * @throws Exception
  */
 protected function configureUploadField($field, $configVarName = 'allowed_files')
 {
     $fieldName = $field->getName();
     if ($field instanceof \DisplayLogicWrapper) {
         // drill down into wrapper to get actual UploadField
         $field = $field->fieldByName($fieldName);
     }
     list($minlength, $maxlength, $pattern) = $this->fieldConstraints($fieldName, [0, 0, '']);
     $field->setAllowedMaxFileNumber($maxlength ?: null);
     // don't allow existing media to be re-attached it's a has_one so would be messy
     $allowExistingFiles = $this->config()->get('can_attach_existing');
     $field->setCanAttachExisting($allowExistingFiles);
     $field->setFolderName($this->uploadFolderName());
     // could be string for category or an array of extensions
     // try extension first, then model
     $extensions = $allowedFiles = $this->config()->get($configVarName) ?: $this()->config()->get($configVarName);
     $categories = [];
     if (!is_array($allowedFiles)) {
         // could be comma separated list of categories
         $categories = explode(',', $allowedFiles);
         // get extensions from category so we always get a list of extensions for the CMS right title
         $allCategoryExtensions = \File::config()->get('app_categories') ?: [];
         foreach ($categories as $category) {
             if (isset($allCategoryExtensions[$category])) {
                 $extensions = $allCategoryExtensions[$category];
             } else {
                 $extensions = [$category];
             }
         }
     }
     if (is_array($allowedFiles)) {
         // was an array originally, so pass merged extensions
         $field->setAllowedExtensions($extensions);
     } elseif ($categories) {
         // array of categories to apply to setAllowedFileCategories as parameters
         call_user_func_array([$field, 'setAllowedFileCategories'], $categories);
     } elseif ($allowedFiles) {
         // not an array so a category e.g. 'video'
         $field->setAllowedFileCategories($allowedFiles);
     } else {
         throw new Exception("No {$configVarName} configuration set");
     }
     $field->setRightTitle($this->fieldDecoration($fieldName, 'Label', $field->Title(), ['extensions' => implode(', ', $extensions)]));
 }
 /**
  * CMS Fields
  * @return array
  */
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $TeaserConfig = GridFieldConfig_RecordEditor::create();
     if ($this->LinkList()->Count() > 0) {
         $TeaserConfig->addComponent(new GridFieldOrderableRows());
     }
     $fields->addFieldsToTab('Root.Main', array(TextareaField::create('Title')->setRows(1), DropdownField::create('LinkType', 'Type', array("currentchildren" => "List all sub pages of this page", "children" => "Specify a page and list all its sub pages", "specify" => "Specify each link")), DisplayLogicWrapper::create(TreeDropdownField::create('ParentPageID', 'Select a page', 'SiteTree'))->displayIf("LinkType")->isEqualTo("children")->end(), DisplayLogicWrapper::create(GridField::create('LinkList', 'Current Link(s)', $this->LinkList(), $TeaserConfig))->displayIf("LinkType")->isEqualTo("specify")->end()));
     return $fields;
 }
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     //		if($this->JobID){
     //			$fields->addFieldToTab("Root.Main", new LiteralField("JobID",
     //		"<p class=\"message good\">Transcoding job ID: {$this->JobID}, Status: {$this->JobStatus}</p>"));
     //		}
     // if transcoding started or error
     if (Session::get('VideoNotification')) {
         $num = 0;
         foreach (Session::get('VideoNotification') as $type => $message) {
             $num += 1;
             $fields->addFieldToTab("Root.Main", new LiteralField("VideoNotification_" . $num, "<p class=\"message {$type}\">{$message}</p>"));
         }
         Session::clear('VideoNotification');
     }
     $UploadSizeMB = 350 * 1024 * 1024;
     // 350 MB in bytes
     // Switch between two views;
     // - Uploadfield for source file (any type) to be transcoded OR
     // - Uploadfields for manually transcoded files
     $mode = new DropdownField('DefaultView', _t('Transcodable.Mode', 'Mode'), array('source' => _t('Transcodable.SourceForTranscoding', 'Upload source file for transcoding'), 'transcoded' => _t('Transcodable.EncodedFormats', 'Upload HTML5 encoded formats')));
     //		$mode->setRightTitle(_t('Transcodable.ModeExplain',
     //				'Upload a source file to be transcoded to all (missing) HTML5 formats. If your source file is already in one of the HTML5 formats, choose "HTML encoded formats" and upload it into the correct upload field (MP4, WEBM or OGG) to have that used as original for transcoding. Only missing formats will be transcoded.'));
     $sourcehead = LiteralField::create('SourceHead', '<h2>' . _t('Transcodable.VideoFiles', 'Video files') . '</h2>' . '<p style="font-size: 120%; max-width: 640px; line-height: 130%;">' . _t('Transcodable.VideoFilesExplain', 'Upload a source file to be transcoded to all (missing) HTML5 formats and a poster image. If your source file is already in one of the HTML5 formats, choose "HTML encoded formats" and upload it into the correct upload field (MP4, WEBM or OGG) to have that used as original for transcoding. Only missing formats/files will be transcoded.') . '</p>');
     $appextensions = Config::inst()->get('File', 'app_categories');
     $movextensions = $appextensions['mov'];
     array_push($movextensions, 'mp4');
     // add mp4 to video (seen as audio)
     $sourcefield = ChunkedUploadField::create("Source")->setTitle(_t('Transcodable.SourceVideo', "Source video"))->setFolderName('videos')->setAllowedExtensions($movextensions);
     $sourcefield->getValidator()->setAllowedMaxFileSize($UploadSizeMB);
     $sourcefieldHolder = DisplayLogicWrapper::create($sourcefield)->displayIf('DefaultView')->isEqualTo("source")->end();
     $posterfield = UploadField::create("Poster")->setTitle("'Poster' image")->setFolderName('videos')->setAllowedExtensions(array("jpg", "jpeg", "gif", "png"));
     //		$posterfieldHolder = DisplayLogicWrapper::create($posterfield)
     //				->displayIf('DefaultView')->isEqualTo("source")->end();
     $mp4field = ChunkedUploadField::create("MP4")->setTitle(_t('Transcodable.MP4video', "MP4 video"))->setFolderName('videos')->setAllowedExtensions(array("mp4"));
     $mp4field->getValidator()->setAllowedMaxFileSize($UploadSizeMB);
     $mp4fieldHolder = DisplayLogicWrapper::create($mp4field)->displayIf('DefaultView')->isEqualTo("transcoded")->end();
     //		$mp4field->displayIf("DefaultView")->isEqualTo("transcoded")->end();
     $webmfield = ChunkedUploadField::create("WEBM")->setTitle(_t('Transcodable.WEBMvideo', "WEBM video"))->setFolderName('videos')->setAllowedExtensions(array("webm"));
     $webmfield->getValidator()->setAllowedMaxFileSize($UploadSizeMB);
     $webmfieldHolder = DisplayLogicWrapper::create($webmfield)->displayIf('DefaultView')->isEqualTo("transcoded")->end();
     //		$webmfield->displayIf("DefaultView")->isEqualTo("transcoded")->end();
     $ogvfield = ChunkedUploadField::create("OGV")->setTitle(_t('Transcodable.OGVvideo', "OGG theora video"))->setFolderName('videos')->setAllowedExtensions(array("ogg", "ogv"));
     $ogvfield->getValidator()->setAllowedMaxFileSize($UploadSizeMB);
     $ogvfieldHolder = DisplayLogicWrapper::create($ogvfield)->displayIf('DefaultView')->isEqualTo("transcoded")->end();
     //		$ogvfield->displayIf("DefaultView")->isEqualTo("transcoded")->end();
     $fields->addFieldsToTab('Root.Main', array($mode, $sourcehead, $sourcefieldHolder, $posterfield, $mp4fieldHolder, $webmfieldHolder, $ogvfieldHolder));
     if ($this->ID) {
         $fields->addFieldsToTab('Root.Main', new HeaderField('scode', $this->ShowShortCode()), 'Name');
     }
     return $fields;
 }
 public function getCMSFields()
 {
     $imagefield = UploadField::create('DefaultPhoto')->setTitle('Default Photo')->setDescription('To be used on individual news pages if feature photo is empty. 2MB max size');
     $imagefield->folderName = 'News';
     $imagefield->getValidator()->allowedExtensions = array('jpg', 'jpeg', 'gif', 'png');
     $imagefield->getValidator()->setAllowedMaxFileSize('2097152');
     // 2 MB in bytes
     $fields = parent::getCMSFields();
     $fields->addFieldToTab('Root.Categories', GridField::create('NewsCategories', 'Category', $this->NewsCategories(), GridFieldConfig_RecordEditor::create(50)));
     $fields->addFieldToTab('Root.Authors', GridField::create('NewsAuthors', 'Author', $this->NewsAuthors(), GridFieldConfig_RecordEditor::create(50)));
     $fields->addFieldsToTab('Root.Config', array(HeaderField::create('ImageHeader')->setTitle('Default Featured Photo Options'), TextField::create('ThumbnailHeight')->setTitle('Feature Photo Height'), TextField::create('ThumbnailWidth')->setTitle('Feature Photo Width'), $imagefield, HeaderField::create('NewsExcerptsHeader')->setTitle('Excerpt Options'), NumericField::create('NewsExcerptsPerPage')->setTitle('News Excerpts Per Page'), HeaderField::create('ShareIcons')->setTitle('Share Icon Options'), CheckboxField::create('ShowShare')->setTitle('Show Share Icons'), DisplayLogicWrapper::create(CheckboxField::create('ShowFacebook')->setTitle('Show Facebook Icon'), CheckboxField::create('ShowTwitter')->setTitle('Show Twitter Icon'), CheckboxField::create('ShowGoogle')->setTitle('Show Google Icon'))->displayIf('ShowShare')->isChecked()->end()));
     return $fields;
 }
Пример #9
0
 /**
  * Returns a FieldList of cms form fields
  *
  * @return FieldList
  */
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     // Hide these from editing
     $fields->removeByName('ParentID');
     $fields->removeByName('Sort');
     //Remove to re-add
     $fields->removeByName('Type');
     $fields->removeByName('LinkLabel');
     $content = $fields->dataFieldByName('Content');
     $numberToDisplay = $fields->dataFieldByName('NumberToDisplay');
     $projectPage = $fields->dataFieldByName('ProjectPageID');
     $html = $fields->dataFieldByName('HTML');
     $subtitle = $fields->dataFieldByName('SubTitle');
     $html->setRows(20);
     $html->addExtraClass('no-pagebreak');
     $link = $fields->dataFieldByName('LinkID');
     $image = $fields->dataFieldByName('Image');
     $image->setFolderName('Uploads/Small-Images');
     $fields->removeByName('Image');
     $fields->insertBefore($projectPage, 'Content');
     $fields->insertAfter($type = OptionSetField::create("Type", "Type", $this->dbObject('Type')->enumValues()), "Colour");
     $type->addExtraClass('inline-short-list');
     $fields->insertAfter(ColorPaletteField::create("Colour", "Colour", array('night' => '#333333', 'air' => '#009EE2', 'earth' => ' #79c608', 'passion' => '#b02635', 'people' => '#de347f', 'inspiration' => '#783980')), "Title");
     $fields->insertAfter($linkLabel = new TextField("LinkLabel", "Link Label"), "LinkID");
     $fields->insertAfter($imageLogin = DisplayLogicWrapper::create($image), 'LinkLabel');
     $imageLogin->hideUnless("Type")->isEqualTo("Content");
     $html->hideUnless("Type")->isEqualTo("HTML");
     $subtitle->hideUnless("Type")->isEqualTo("HTML");
     $link->hideUnless("Type")->isEqualTo("Content")->orIf("Type")->isEqualTo("Project");
     $linkLabel->hideUnless("LinkID")->isGreaterThan(0)->andIf("Type")->isEqualTo("Content");
     $numberToDisplay->hideIf("Type")->isEqualTo("Content")->orIf("Type")->isEqualTo("HTML");
     $projectPage->hideUnless("Type")->isEqualTo("Project");
     $content->hideUnless("Type")->isEqualTo("Content");
     // Archived
     $fields->removeByName('Archived');
     $fields->addFieldToTab('Root.Main', $group = new CompositeField($label = new LabelField("LabelArchive", "Archive this feature?"), new CheckboxField('Archived', '')));
     $group->addExtraClass("special field");
     $label->addExtraClass("left");
     return $fields;
 }
 /**
  * Returns array of fields to be added to Gallery Settings Tab
  *
  * @return array
  */
 public function getFieldsForSettingsTab()
 {
     $aFields = array(new OptionsetField('ShowAllComponents', _t('ResponsiveGalleryExtension.COMPONENTSETTINGS_LABEL', 'Display Components'), $source = array("1" => _t('ResponsiveGalleryExtension.SHOWALLCOMPONENTS_LABEL', 'Display all components'), "0" => _t('ResponsiveGalleryExtension.SHOWCUSTOMIZEDCOMPONENTS_LABEL', 'Customized ...')), $value = "1"));
     $aFields[] = DisplayLogicWrapper::create(new LiteralField('EmptySettingsWarning', '<p class="message warning">' . _t('ResponsiveGalleryExtension.EMPTY_SETTINGS_WARNING', 'Warning: You should choose at least one option.') . '</p>'))->setName('EmptySettingsWarningWrapper')->hideIf("ShowAllComponents")->isEqualTo('1')->orIf("DisplayCarousel")->isChecked()->orIf("DisplayModal")->isChecked()->end();
     $aFields[] = DisplayLogicWrapper::create(HeaderField::create('<img src="' . RESPONSIVE_GALLERY_PATH . '/images/settings/show-carousel.png" title="Display Carousel?"> ' . _t('ResponsiveGalleryExtension.SETTINGS_CAROUSEL_HEADER', 'Carousel settings')))->setName('SettingsCarouselHeaderWrapper')->displayIf("ShowAllComponents")->isEqualTo('0')->end();
     $aFields[] = CheckboxField::create('DisplayCarousel', '<strong>' . _t('ResponsiveGalleryExtension.SETTINGS_SHOWCAROUSEL_LABEL', 'Display Carousel') . '</strong>')->displayIf("ShowAllComponents")->isEqualTo('0')->end();
     $aFields[] = CheckboxField::create('DisplayCarouselTitle', _t('ResponsiveGalleryExtension.SETTINGS_SHOWCAROUSELTITLE_LABEL', 'Display Carousel Title'))->displayIf("ShowAllComponents")->isEqualTo('0')->andIf('DisplayCarousel')->isChecked()->end();
     $aFields[] = CheckboxField::create('DisplayCarouselPrevNext', _t('ResponsiveGalleryExtension.SETTINGS_SHOWCAROUSELPREVNEXT_LABEL', 'Display Carousel Prev/Next Buttons'))->displayIf("ShowAllComponents")->isEqualTo('0')->andIf('DisplayCarousel')->isChecked()->end();
     $aFields[] = CheckboxField::create('DisplayCarouselPlayPause', _t('ResponsiveGalleryExtension.SETTINGS_SHOWCAROUSELPLAYPAUSE_LABEL', 'Display Carousel Play/Pause Button'))->displayIf("ShowAllComponents")->isEqualTo('0')->andIf('DisplayCarousel')->isChecked()->end();
     $aFields[] = CheckboxField::create('DisplayCarouselIndicator', _t('ResponsiveGalleryExtension.SETTINGS_SHOWCAROUSELINDICATOR_LABEL', 'Display Indicator List in Carousel Footer'))->displayIf("ShowAllComponents")->isEqualTo('0')->andIf('DisplayCarousel')->isChecked()->end();
     $aFields[] = DisplayLogicWrapper::create(HeaderField::create('<img src="' . RESPONSIVE_GALLERY_PATH . '/images/settings/show-imagelist.png" title="Display image list and enable fullscreen mode?"> ' . _t('ResponsiveGalleryExtension.SETTINGS_IMAGELIST_HEADER', 'Image list and fullscreen settings')))->setName('SettingsModalHeaderWrapper')->displayIf("ShowAllComponents")->isEqualTo('0')->end();
     $aFields[] = CheckboxField::create('DisplayModal', '<strong>' . _t('ResponsiveGalleryExtension.SETTINGS_SHOWMODAL_LABEL', 'Display Modal') . '</strong>')->displayIf("ShowAllComponents")->isEqualTo('0')->end();
     $aFields[] = CheckboxField::create('DisplayModalTitle', _t('ResponsiveGalleryExtension.SETTINGS_SHOWMODALTITLE_LABEL', 'Display Modal Title'))->displayIf("ShowAllComponents")->isEqualTo('0')->andIf('DisplayModal')->isChecked()->end();
     $aFields[] = CheckboxField::create('DisplayModalPrevNext', _t('ResponsiveGalleryExtension.SETTINGS_SHOWMODALPREVNEXT_LABEL', 'Display Modal Prev/Next Buttons'))->displayIf("ShowAllComponents")->isEqualTo('0')->andIf('DisplayModal')->isChecked()->end();
     $aFields[] = CheckboxField::create('DisplayModalPlayPause', _t('ResponsiveGalleryExtension.SETTINGS_SHOWMODALPLAYPAUSE_LABEL', 'Display Modal Play/Pause Button'))->displayIf("ShowAllComponents")->isEqualTo('0')->andIf('DisplayModal')->isChecked()->end();
     $aFields[] = CheckboxField::create('DisplayModalIndicator', _t('ResponsiveGalleryExtension.SETTINGS_SHOWMODALINDICATOR_LABEL', 'Display Modal Play/Pause Button'))->displayIf("ShowAllComponents")->isEqualTo('0')->andIf('DisplayModal')->isChecked()->end();
     return $aFields;
 }
 public function updateCMSFields(FieldList $fields)
 {
     $userFields = Config::inst()->get('Intercom', 'lead_fields');
     $companyFields = Config::inst()->get('Intercom', 'company_fields');
     $fields->addFieldsToTab('Root.Intercom', array(CheckboxField::create('MapToIntercom', 'Store this field in Intercom'), DisplayLogicWrapper::create(DropdownField::create('IntercomFieldType', 'Where will this field be stored?', array('USER' => 'On the person', 'COMPANY' => 'On the company', 'NOTE' => 'In notes'))->setEmptyString('--- Please select ---'), DropdownField::create('IntercomUserField', 'Which user field in Intercom does it map to?')->setSource(ArrayLib::valuekey($userFields))->displayIf('IntercomFieldType')->isEqualTo('USER')->end(), DropdownField::create('IntercomCompanyField', 'Which company field in Intercom does it map to?')->setSource(ArrayLib::valuekey($companyFields))->displayIf('IntercomFieldType')->isEqualTo('COMPANY')->end(), TextField::create('CustomAttributeName', 'Custom attribute name')->setDescription('No spaces, ideally lowercase_with_underscores')->displayIf('IntercomCompanyField')->isEqualTo('custom_attributes')->orIf('IntercomUserField')->isEqualTo('custom_attributes')->end(), TextField::create('NoteLabel', 'Label for this field in the note')->setDescription('Note: this should probably be the same as the "Title" field on the Main tab')->displayIf('IntercomFieldType')->isEqualTo('NOTE')->end())->displayIf('MapToIntercom')->isChecked()->end()));
 }
 private function advancedSettingsFields($subsites, $currentSubsiteID)
 {
     $applyPerSubsite = '';
     if ($subsites && $currentSubsiteID == 0) {
         $applyPerSubsite = CheckboxField::create('MailblockApplyPerSubsite', _t('Mailblock.ApplyPerSubsite', 'Apply mailblock settings per subsite.'))->setDescription(_t('Mailblock.ApplyPerSubsiteDescription', 'If ticked then different mailblock settings appply ' . 'per subsite rather than globally.'));
     }
     $tab = Tab::create('AdvancedSettings', DisplayLogicWrapper::create(LiteralField::create('MailblockAdvancedSettings', '<p class="message notice">' . _t('Mailblock.AdvancedSettings', 'Enable mailblock to view advanced settings.') . '</p>'))->hideIf('MailblockEnabled')->isChecked()->end(), CheckboxField::create('MailblockEnabledOnLive', _t('Mailblock.EnabledOnLive', 'Enable mailblock on live site.'))->setDescription(_t('Mailblock.EnabledOnLiveDescription', 'Whether messages sent via the MailblockMailer should be ' . 'redirected to the below recipient(s). Useful for prelive sites.')), $overrideConfiguration = CheckboxField::create('MailblockOverrideConfiguration', _t('Mailblock.OverrideConfiguration', 'Override configuration settings.'))->setDescription(_t('Mailblock.OverrideConfigurationDescription', 'Whether mailblock should override the hard coded Email class ' . '\'send_all_emails_to\' configuration setting.')), $applyPerSubsite);
     return $tab;
 }