function __construct($controller, $name, $company) { // Define fields ////////////////////////////////////// if ($company->canEditProfile()) { $fields = new FieldList(new TextField('Name', 'Company Name'), new TextField('URL', 'Company Web Address (URL)'), new LiteralField('Break', '<p></p>'), new LiteralField('Break', '<hr/>'), $big_logo = new FileAttachmentField('BigLogo', 'Large Company Logo'), $small_logo = new FileAttachmentField('Logo', 'Small Company Logo'), new LiteralField('Break', '<p></p>'), new LiteralField('Break', '<hr/>'), new TextField('Industry', 'Industry (less than 4 Words)'), $desc = new HtmlEditorField('Description', 'Company Description'), new LiteralField('Break', '<p></p>'), $contrib = new HtmlEditorField('Contributions', 'How you are contributing to OpenStack (less than 150 words)'), new LiteralField('Break', '<p></p>'), $products = new HtmlEditorField('Products', 'Products/Services Related to OpenStack (less than 100 words)'), new LiteralField('Break', '<p></p>'), new LiteralField('Break', '<p></p>'), new ColorField("Color", "Company Color"), new LiteralField('Break', '<p></p>'), new LiteralField('Break', '<hr/>'), new TextField('ContactEmail', 'Best Contact email address (optional)'), new LiteralField('Break', '<p>This email address will be displayed on your profile and may be different than your own address.')); $desc->addExtraClass("company-description"); $contrib->addExtraClass("company-contributions"); $products->addExtraClass("company-products"); $big_logo_validator = new Upload_Image_Validator(); $big_logo_validator->setAllowedExtensions(array('jpg', 'png', 'jpeg')); $big_logo_validator->setAllowedMaxImageWidth(500); $big_logo->setAcceptedFiles(array('jpg', 'png', 'jpeg')); $big_logo->setView('grid'); $big_logo->setFolderName('companies/main_logo'); $big_logo->setValidator($big_logo_validator); $small_logo_validator = new Upload_Image_Validator(); $small_logo_validator->setAllowedExtensions(array('jpg', 'png', 'jpeg')); $small_logo_validator->setAllowedMaxImageWidth(200); $small_logo->setAcceptedFiles(array('jpg', 'png', 'jpeg')); $small_logo->setView('grid'); $small_logo->setFolderName('companies/main_logo'); $small_logo->setValidator($small_logo_validator); } else { if ($company->canEditLogo()) { $fields = new FieldList(new ReadonlyField('Name', 'Company Name'), new ReadonlyField('URL', 'Company Web Address (URL)'), new LiteralField('Break', '<p></p>'), new LiteralField('Break', '<hr/>'), new CustomUploadField('BigLogo', 'Large Company Logo'), new CustomUploadField('Logo', 'Small Company Logo')); } } $actionButton = new FormAction('save', 'Save Changes'); //$actionButton->addExtraClass('btn green-btn'); $actions = new FieldList($actionButton); parent::__construct($controller, $name, $fields, $actions); }
function __construct($controller, $name, $use_actions = true) { $fields = new FieldList(); //point of contact $fields->push($point_of_contact_name = new TextField('point_of_contact_name', 'Name')); $fields->push($point_of_contact_email = new EmailField('point_of_contact_email', 'Email')); //main info $fields->push($title = new TextField('title', 'Title')); $fields->push($url = new TextField('url', 'Url')); $fields->push(new CheckboxField('is_coa_needed', 'Is COA needed?')); $fields->push($ddl_type = new DropdownField('job_type', 'Job Type', JobType::get()->sort("Type")->map("ID", "Type"))); $ddl_type->setEmptyString("--SELECT A JOB TYPE --"); $fields->push($description = new HtmlEditorField('description', 'Description')); $fields->push($instructions = new HtmlEditorField('instructions', 'Instructions To Apply')); $fields->push($expiration_date = new TextField('expiration_date', 'Expiration Date')); $fields->push($company = new CompanyField('company', 'Company')); $point_of_contact_name->addExtraClass('job_control'); $point_of_contact_email->addExtraClass('job_control'); $title->addExtraClass('job_control'); $url->addExtraClass('job_control'); $description->addExtraClass('job_control'); $instructions->addExtraClass('job_control'); $expiration_date->addExtraClass('job_control'); $company->addExtraClass('job_control'); //location $ddl_locations = new DropdownField('location_type', 'Location Type', array('N/A' => 'N/A', 'Remote' => 'Remote', 'Various' => 'Add a Location')); $ddl_locations->addExtraClass('location_type'); $ddl_locations->addExtraClass('job_control'); $fields->push($ddl_locations); $fields->push($city = new TextField('city', 'City')); $fields->push($state = new TextField('state', 'State')); $fields->push($country = new CountryDropdownField('country', 'Country')); $city->addExtraClass('physical_location'); $state->addExtraClass('physical_location'); $country->addExtraClass('physical_location'); // Guard against automated spam registrations by optionally adding a field // that is supposed to stay blank (and is hidden from most humans). // The label and field name are intentionally common ("username"), // as most spam bots won't resist filling it out. The actual username field // on the forum is called "Nickname". $fields->push(new TextField('user_name', 'UserName')); // Create action $actions = new FieldList(); if ($use_actions) { $actions->push(new FormAction('saveJobRegistrationRequest', 'Save')); } // Create validators $validator = new ConditionalAndValidationRule([new HtmlPurifierRequiredValidator('title', 'instructions', 'description'), new RequiredFields('job_type', 'point_of_contact_name', 'point_of_contact_email')]); $this->addExtraClass('job-registration-form'); $this->addExtraClass('input-form'); parent::__construct($controller, $name, $fields, $actions, $validator); }
function __construct($controller, $name, $use_actions = true) { $fields = new FieldList(); //main info $fields->push($title = new TextField('title', 'Title')); $fields->push($url = new TextField('url', 'Url')); $fields->push($description = new HtmlEditorField('description', 'Description')); $fields->push($instructions = new HtmlEditorField('instructions', 'Instructions To Apply')); $fields->push($expiration_date = new TextField('expiration_date', 'Expiration Date')); $fields->push($company = new TextField('company_name', 'Company')); $title->addExtraClass('job_control'); $url->addExtraClass('job_control'); $description->addExtraClass('job_control'); $instructions->addExtraClass('job_control'); $expiration_date->addExtraClass('job_control'); $company->addExtraClass('job_control'); //location $ddl_locations = new DropdownField('location_type', 'Location Type', array('N/A' => 'N/A', 'Remote' => 'Remote', 'Various' => 'Add a Location')); $ddl_locations->addExtraClass('location_type'); $ddl_locations->addExtraClass('job_control'); $fields->push($ddl_locations); $fields->push($city = new TextField('city', 'City')); $fields->push($state = new TextField('state', 'State')); $fields->push($country = new CountryDropdownField('country', 'Country')); $city->addExtraClass('physical_location'); $state->addExtraClass('physical_location'); $country->addExtraClass('physical_location'); // Guard against automated spam registrations by optionally adding a field // that is supposed to stay blank (and is hidden from most humans). // The label and field name are intentionally common ("username"), // as most spam bots won't resist filling it out. The actual username field // on the forum is called "Nickname". $fields->push(new TextField('user_name', 'UserName')); // Create action $actions = new FieldList(); if ($use_actions) { $actions->push(new FormAction('saveJob', 'Save')); } // Create validators $validator = new ConditionalAndValidationRule(array(new HtmlPurifierRequiredValidator('title', 'company_name', 'instructions', 'description'))); $this->addExtraClass('job-registration-form'); parent::__construct($controller, $name, $fields, $actions, $validator); }
public function getCMSFields() { $fields = parent::getCMSFields(); $fields->addFieldToTab('Root.Main', new TextField('Author', _t('NewsArticle.AUTHOR', 'Author')), 'Content'); $fields->addFieldToTab('Root.Main', $dp = new DateField('OriginalPublishedDate', _t('NewsArticle.PUBLISHED_DATE', 'When was this article first published?')), 'Content'); $dp->setConfig('showcalendar', true); $fields->addFieldToTab('Root.Main', new TextField('ExternalURL', _t('NewsArticle.EXTERNAL_URL', 'External URL to article (will automatically redirect to this URL if no article content set)')), 'Content'); $fields->addFieldToTab('Root.Main', new TextField('Source', _t('NewsArticle.SOURCE', 'News Source')), 'Content'); $fields->addFieldToTab('Root.Main', $if = new UploadField('Thumbnail', _t('NewsArticle.THUMB', 'Thumbnail')), 'Content'); $if->setConfig('allowedMaxFileNumber', 1)->setFolderName('news-articles/thumbnails'); $if->getValidator()->setAllowedExtensions(array('jpg', 'jpeg', 'png', 'gif')); if (!$this->OriginalPublishedDate) { // @TODO Fix this to be correctly localized!! $this->OriginalPublishedDate = date('Y-m-d'); } $fields->addFieldToTab('Root.Main', UploadField::create('InternalFile', _t('NewsArticle.INTERNAL_FILE', 'Select a file containing this news article, if any'))->setFolderName('news'), 'Content'); $fields->addFieldToTab('Root.Main', $summary = new HtmlEditorField('Summary', _t('NewsArticle.SUMMARY', 'Article Summary (displayed in listings)')), 'Content'); $summary->addExtraClass('stacked'); $this->extend('updateArticleCMSFields', $fields); return $fields; }
function __construct($controller, $name, $article = null, bool $is_manager, $use_actions = true) { $IDField = new HiddenField('newsID'); //madatory fields $HeadlineField = new TextField('headline', 'Headline (150 character max)', '', $maxLength = 150); $HeadlineField->addExtraClass('headline'); $SummaryField = new HtmlEditorField('summary', 'Summary (300 character max)'); $SummaryField->addExtraClass('summary'); $SummaryField->setAttribute('max_chars', 300); $CityField = new TextField('city', 'City'); $StateField = new TextField('state', 'State'); $CountryField = new CountryDropdownField('country', 'Country'); $TagsField = new TextField('tags', 'Tags'); $DateEmbargoField = new TextField('date_embargo', 'Desired release date/time: Time zone is Central Time. Please ensure your release date is in Central Time (<a target="_blank" href="http://www.timeanddate.com/worldclock/converter.html">time converter</a>)'); $DateEmbargoField->addExtraClass('datefield'); if ($is_manager) { $DateExpireField = new TextField('date_expire', 'Expire Date'); $DateExpireField->addExtraClass('datefield'); } $UpdatedField = new DatetimeField_Readonly('date_updated', 'Last Updated'); //$UpdatedField->addExtraClass('inline'); //optional fields $BodyField = new HtmlEditorField('body', 'Body'); $LinkField = new TextField('link', 'Link'); $DocumentField = new CustomUploadField('Document', 'Document'); $DocumentField->addExtraClass('hidden'); $DocumentField->setCanAttachExisting(false); $DocumentField->setAllowedMaxFileNumber(1); $DocumentField->setAllowedFileCategories('doc'); $DocumentField->setTemplateFileButtons('CustomUploadField_FrontEndFIleButtons'); $DocumentField->setFolderName('news-documents'); $sizeMB = 1; // 1 MB $size = $sizeMB * 1024 * 1024; // 1 MB in bytes $DocumentField->getValidator()->setAllowedMaxFileSize($size); $DocumentField->setCanPreviewFolder(false); // Don't show target filesystem folder on upload field $DocumentField->setRecordClass('File'); $ImageField = new CustomUploadField('Image', 'Image (Max size 2Mb - Suggested size 300x250px)'); $ImageField->setCanAttachExisting(false); $ImageField->setAllowedMaxFileNumber(1); $ImageField->setAllowedFileCategories('image'); $ImageField->setTemplateFileButtons('CustomUploadField_FrontEndFIleButtons'); $ImageField->setFolderName('news-images'); $ImageField->setRecordClass('BetterImage'); $ImageField->getUpload()->setReplaceFile(false); $ImageField->setOverwriteWarning(false); $sizeMB = 2; // 2 MB $size = $sizeMB * 1024 * 1024; // 2 MB in bytes $ImageField->getValidator()->setAllowedMaxFileSize($size); $ImageField->setCanPreviewFolder(false); // Don't show target filesystem folder on upload field if ($is_manager) { $IsLandscapeField = new CheckboxField('is_landscape', 'Is Banner? (landscape image)'); $IsLandscapeField->addExtraClass('is_landscape'); } if ($article) { $IDField->setValue($article->ID); $HeadlineField->setValue($article->Headline); $SummaryField->setValue($article->Summary); $CityField->setValue($article->City); $StateField->setValue($article->State); $CountryField->setValue($article->Country); $TagsField->setValue($article->getTagsCSV()); if ($article->DateEmbargo) { $DateEmbargoField->setValue(date('m/d/Y g:i a', strtotime($article->DateEmbargo))); } else { $DateEmbargoField->setValue(gmdate('m/d/Y g:i a')); } $UpdatedField->setValue($article->LastEdited); $BodyField->setValue($article->Body); $LinkField->setValue($article->Link); if ($article->DateExpire) { $DateExpireField->setValue(date('m/d/Y g:i a', strtotime($article->DateExpire))); } $IsLandscapeField->setValue($article->IsLandscape); //submitter read only $SubmitterFirstNameField = new ReadonlyField('submitter_first_name', 'First Name'); $SubmitterLastNameField = new ReadonlyField('submitter_last_name', 'Last Name'); $SubmitterEmailField = new ReadonlyField('submitter_email', 'Email'); $SubmitterCompanyField = new ReadonlyField('submitter_company', 'Company'); $SubmitterPhoneField = new ReadonlyField('submitter_phone', 'Phone'); $SubmitterFirstNameField->setValue($article->getSubmitter()->FirstName); $SubmitterLastNameField->setValue($article->getSubmitter()->LastName); $SubmitterEmailField->setValue($article->getSubmitter()->Email); $SubmitterCompanyField->setValue($article->getSubmitter()->Company); $SubmitterPhoneField->setValue($article->getSubmitter()->Phone); } else { // submitter fields $SubmitterFirstNameField = new TextField('submitter_first_name', 'First Name'); $SubmitterLastNameField = new TextField('submitter_last_name', 'Last Name'); $SubmitterEmailField = new TextField('submitter_email', 'Email'); $SubmitterCompanyField = new TextField('submitter_company', 'Company'); $SubmitterPhoneField = new TextField('submitter_phone', 'Phone'); $LinkField->setValue('http://'); } $fields = new FieldList($IDField, $HeadlineField, $SummaryField, $CityField, $StateField, $CountryField, $TagsField, $DateEmbargoField); if ($is_manager) { $fields->push($DateExpireField); $fields->push($UpdatedField); } $fields->push(new LiteralField('clear', '<div class="clear"></div>')); $fields->push($BodyField); $fields->push($LinkField); $fields->push($DocumentField); if ($article) { $image = $article->Image(); $document = $article->Document(); if ($document->exists()) { $fields->push(new LiteralField('image_preview', $document->CMSThumbnail())); } $fields->push(new LiteralField('break', '<br/>')); $fields->push($ImageField); if ($image->exists()) { $ImageField->setValue(null, $article); } } else { $fields->push(new LiteralField('break', '<br/>')); $fields->push($ImageField); } if ($is_manager) { $fields->push($IsLandscapeField); $fields->push(new LiteralField('break', '<br/>')); } $fields->push(new LiteralField('break', '<br/><hr/>')); $fields->push(new LiteralField('title', '<h2>Submitter</h2>')); $fields->push($SubmitterFirstNameField); $fields->push($SubmitterLastNameField); $fields->push($SubmitterEmailField); $fields->push($SubmitterCompanyField); $fields->push($SubmitterPhoneField); // Create action $actions = new FieldList(); $actions->push(new FormAction('saveNewsArticle', 'Save')); $this->addExtraClass('news-registration-form'); parent::__construct($controller, $name, $fields, $actions, $validator = null); }
/** * Returns a FieldList with which to create the main editing form. * * You can override this in your child classes to add extra fields - first get the parent fields using * parent::getCMSFields(), then use addFieldToTab() on the FieldList. * * See {@link getSettingsFields()} for a different set of fields concerned with configuration aspects on the record, * e.g. access control. * * @return FieldList The fields to be displayed in the CMS */ public function getCMSFields() { require_once "forms/Form.php"; // Status / message // Create a status message for multiple parents if ($this->ID && is_numeric($this->ID)) { $linkedPages = $this->VirtualPages(); $parentPageLinks = array(); if ($linkedPages->Count() > 0) { foreach ($linkedPages as $linkedPage) { $parentPage = $linkedPage->Parent; if ($parentPage) { if ($parentPage->ID) { $parentPageLinks[] = "<a class=\"cmsEditlink\" href=\"admin/pages/edit/show/{$linkedPage->ID}\">{$parentPage->Title}</a>"; } else { $parentPageLinks[] = "<a class=\"cmsEditlink\" href=\"admin/pages/edit/show/{$linkedPage->ID}\">" . _t('SiteTree.TOPLEVEL', 'Site Content (Top Level)') . "</a>"; } } } $lastParent = array_pop($parentPageLinks); $parentList = "'{$lastParent}'"; if (count($parentPageLinks) > 0) { $parentList = "'" . implode("', '", $parentPageLinks) . "' and " . $parentList; } $statusMessage[] = _t('SiteTree.APPEARSVIRTUALPAGES', "This content also appears on the virtual pages in the {title} sections.", array('title' => $parentList)); } } if ($this->HasBrokenLink || $this->HasBrokenFile) { $statusMessage[] = _t('SiteTree.HASBROKENLINKS', "This page has broken links."); } $dependentNote = ''; $dependentTable = new LiteralField('DependentNote', '<p></p>'); // Create a table for showing pages linked to this one $dependentPages = $this->DependentPages(); $dependentPagesCount = $dependentPages->Count(); if ($dependentPagesCount) { $dependentColumns = array('Title' => $this->fieldLabel('Title'), 'AbsoluteLink' => _t('SiteTree.DependtPageColumnURL', 'URL'), 'DependentLinkType' => _t('SiteTree.DependtPageColumnLinkType', 'Link type')); if (class_exists('Subsite')) { $dependentColumns['Subsite.Title'] = singleton('Subsite')->i18n_singular_name(); } $dependentNote = new LiteralField('DependentNote', '<p>' . _t('SiteTree.DEPENDENT_NOTE', 'The following pages depend on this page. This includes virtual pages, redirector pages, and pages with content links.') . '</p>'); $dependentTable = GridField::create('DependentPages', false, $dependentPages); $dependentTable->getConfig()->getComponentByType('GridFieldDataColumns')->setDisplayFields($dependentColumns)->setFieldFormatting(array('Title' => function ($value, &$item) { return sprintf('<a href="admin/pages/edit/show/%d">%s</a>', (int) $item->ID, Convert::raw2xml($item->Title)); }, 'AbsoluteLink' => function ($value, &$item) { return sprintf('<a href="%s" target="_blank">%s</a>', Convert::raw2xml($value), Convert::raw2xml($value)); })); } $baseLink = Controller::join_links(Director::absoluteBaseURL(), self::config()->nested_urls && $this->ParentID ? $this->Parent()->RelativeLink(true) : null); $urlsegment = new SiteTreeURLSegmentField("URLSegment", $this->fieldLabel('URLSegment')); $urlsegment->setURLPrefix($baseLink); $helpText = self::config()->nested_urls && count($this->Children()) ? $this->fieldLabel('LinkChangeNote') : ''; if (!Config::inst()->get('URLSegmentFilter', 'default_allow_multibyte')) { $helpText .= $helpText ? '<br />' : ''; $helpText .= _t('SiteTreeURLSegmentField.HelpChars', ' Special characters are automatically converted or removed.'); } $urlsegment->setHelpText($helpText); $fields = new FieldList($rootTab = new TabSet("Root", $tabMain = new Tab('Main', new TextField("Title", $this->fieldLabel('Title')), $urlsegment, new TextField("MenuTitle", $this->fieldLabel('MenuTitle')), $htmlField = new HtmlEditorField("Content", _t('SiteTree.HTMLEDITORTITLE', "Content", 'HTML editor title')), ToggleCompositeField::create('Metadata', _t('SiteTree.MetadataToggle', 'Metadata'), array($metaFieldDesc = new TextareaField("MetaDescription", $this->fieldLabel('MetaDescription')), $metaFieldExtra = new TextareaField("ExtraMeta", $this->fieldLabel('ExtraMeta'))))->setHeadingLevel(4)), $tabDependent = new Tab('Dependent', $dependentNote, $dependentTable))); $htmlField->addExtraClass('stacked'); // Help text for MetaData on page content editor $metaFieldDesc->setRightTitle(_t('SiteTree.METADESCHELP', "Search engines use this content for displaying search results (although it will not influence their ranking)."))->addExtraClass('help'); $metaFieldExtra->setRightTitle(_t('SiteTree.METAEXTRAHELP', "HTML tags for additional meta information. For example <meta name=\"customName\" content=\"your custom content here\" />"))->addExtraClass('help'); // Conditional dependent pages tab if ($dependentPagesCount) { $tabDependent->setTitle(_t('SiteTree.TABDEPENDENT', "Dependent pages") . " ({$dependentPagesCount})"); } else { $fields->removeFieldFromTab('Root', 'Dependent'); } $tabMain->setTitle(_t('SiteTree.TABCONTENT', "Main Content")); if ($this->ObsoleteClassName) { $obsoleteWarning = _t('SiteTree.OBSOLETECLASS', "This page is of obsolete type {type}. Saving will reset its type and you may lose data", array('type' => $this->ObsoleteClassName)); $fields->addFieldToTab("Root.Main", new LiteralField("ObsoleteWarningHeader", "<p class=\"message warning\">{$obsoleteWarning}</p>"), "Title"); } if (file_exists(BASE_PATH . '/install.php')) { $fields->addFieldToTab("Root.Main", new LiteralField("InstallWarningHeader", "<p class=\"message warning\">" . _t("SiteTree.REMOVE_INSTALL_WARNING", "Warning: You should remove install.php from this SilverStripe install for security reasons.") . "</p>"), "Title"); } // Backwards compat: Rewrite nested "Content" tabs to toplevel $fields->setTabPathRewrites(array('/^Root\\.Content\\.Main$/' => 'Root.Main', '/^Root\\.Content\\.([^.]+)$/' => 'Root.\\1')); if (self::$runCMSFieldsExtensions) { $this->extend('updateCMSFields', $fields); } return $fields; }
/** * Returns a FieldList with which to create the main editing form. * * You can override this in your child classes to add extra fields - first * get the parent fields using parent::getCMSFields(), then use * addFieldToTab() on the FieldList. * * See {@link getSettingsFields()} for a different set of fields * concerned with configuration aspects on the record, e.g. access control * * @return FieldList The fields to be displayed in the CMS. */ function getCMSFields() { require_once("forms/Form.php"); // Status / message // Create a status message for multiple parents if($this->ID && is_numeric($this->ID)) { $linkedPages = $this->VirtualPages(); $parentPageLinks = array(); if($linkedPages->Count() > 0) { foreach($linkedPages as $linkedPage) { $parentPage = $linkedPage->Parent; if($parentPage) { if($parentPage->ID) { $parentPageLinks[] = "<a class=\"cmsEditlink\" href=\"admin/show/$linkedPage->ID\">{$parentPage->Title}</a>"; } else { $parentPageLinks[] = "<a class=\"cmsEditlink\" href=\"admin/show/$linkedPage->ID\">" . _t('SiteTree.TOPLEVEL', 'Site Content (Top Level)') . "</a>"; } } } $lastParent = array_pop($parentPageLinks); $parentList = "'$lastParent'"; if(count($parentPageLinks) > 0) { $parentList = "'" . implode("', '", $parentPageLinks) . "' and " . $parentList; } $statusMessage[] = sprintf( _t('SiteTree.APPEARSVIRTUALPAGES', "This content also appears on the virtual pages in the %s sections."), $parentList ); } } if($this->HasBrokenLink || $this->HasBrokenFile) { $statusMessage[] = _t('SiteTree.HASBROKENLINKS', "This page has broken links."); } $dependentNote = ''; $dependentTable = new LiteralField('DependentNote', '<p></p>'); // Create a table for showing pages linked to this one $dependentPagesCount = $this->DependentPagesCount(); if($dependentPagesCount) { $dependentColumns = array( 'Title' => $this->fieldLabel('Title'), 'AbsoluteLink' => _t('SiteTree.DependtPageColumnURL', 'URL'), 'DependentLinkType' => _t('SiteTree.DependtPageColumnLinkType', 'Link type'), ); if(class_exists('Subsite')) $dependentColumns['Subsite.Title'] = singleton('Subsite')->i18n_singular_name(); $dependentNote = new LiteralField('DependentNote', '<p>' . _t('SiteTree.DEPENDENT_NOTE', 'The following pages depend on this page. This includes virtual pages, redirector pages, and pages with content links.') . '</p>'); $dependentTable = new TableListField( 'DependentPages', $this->DependentPages(), $dependentColumns ); $dependentTable->setFieldFormatting(array( 'Title' => '<a href=\"admin/show/$ID\">$Title</a>', 'AbsoluteLink' => '<a href=\"$value\">$value</a>', )); $dependentTable->setPermissions(array( 'show', 'export' )); } $baseLink = Controller::join_links ( Director::absoluteBaseURL(), (self::nested_urls() && $this->ParentID ? $this->Parent()->RelativeLink(true) : null) ); $url = (strlen($baseLink) > 36) ? "..." .substr($baseLink, -32) : $baseLink; $urlsegment = new SiteTreeURLSegmentField("URLSegment", $this->fieldLabel('URLSegment')); $urlsegment->setURLPrefix($url); $urlsegment->setHelpText(self::nested_urls() && count($this->Children()) ? $this->fieldLabel('LinkChangeNote'): false); $fields = new FieldList( $rootTab = new TabSet("Root", $tabMain = new Tab('Main', new TextField("Title", $this->fieldLabel('Title')), new TextField("MenuTitle", $this->fieldLabel('MenuTitle')), $htmlField = new HtmlEditorField("Content", _t('SiteTree.HTMLEDITORTITLE', "Content", 'HTML editor title')) ), $tabMeta = new Tab('Metadata', $urlsegment, new TextField("MetaTitle", $this->fieldLabel('MetaTitle')), new TextareaField("MetaKeywords", $this->fieldLabel('MetaKeywords'), 1), new TextareaField("MetaDescription", $this->fieldLabel('MetaDescription')), new TextareaField("ExtraMeta",$this->fieldLabel('ExtraMeta')) ), $tabDependent = new Tab('Dependent', $dependentNote, $dependentTable ) ) ); $htmlField->addExtraClass('stacked'); // Conditional dependent pages tab if($dependentPagesCount) $tabDependent->setTitle(_t('SiteTree.TABDEPENDENT', "Dependent pages") . " ($dependentPagesCount)"); else $fields->removeFieldFromTab('Root', 'Dependent'); $tabMain->setTitle(_t('SiteTree.TABCONTENT', "Main Content")); $tabMeta->setTitle(_t('SiteTree.TABMETA', "Metadata")); if(file_exists(BASE_PATH . '/install.php')) { $fields->addFieldToTab("Root.Main", new LiteralField("InstallWarningHeader", "<p class=\"message warning\">" . _t("SiteTree.REMOVE_INSTALL_WARNING", "Warning: You should remove install.php from this SilverStripe install for security reasons.") . "</p>"), "Title"); } if(self::$runCMSFieldsExtensions) { $this->extend('updateCMSFields', $fields); } return $fields; }