public function getCMSFields() { $fields = parent::getCMSFields(); // Basic information $fields->fieldByName('Root.Main')->getChildren()->changeFieldOrder(array('MenuTitle', 'Description', 'Path', 'Href')); $fields->addFieldToTab('Root.Main', new ReadonlyField('DrupalID', 'Menu Link ID'), 'Title'); $fields->removeByName('Options'); // Details $optionsText = '(none)'; $options = $this->Options->toMap(); if ($options) { $optionsText = ''; foreach ($options as $key => $value) { $optionsText .= "{$key} = {$value}, "; } $optionsText = substr($optionsText, 0, -2); } $fields->addFieldToTab('Root.Details', new ReadonlyField('OptionList', 'Options', $optionsText)); $fields->addFieldsToTab('Root.Behaviour', array(new ReadonlyField('Hidden', 'Hidden', $this->Hidden), new ReadonlyField('External', 'External', $this->External), new ReadonlyField('HasChildren', 'HasChildren', $this->HasChildren), new ReadonlyField('Weight', 'Weight', $this->Weight), new ReadonlyField('Depth', 'Depth', $this->Depth))); if ($this->Node) { $fields->addFieldsToTab('Root.Node', array(new ReadonlyField('NodeDrupalID', 'Drupal ID', $this->Node->DrupalID), new ReadonlyField('NodeVersionID', 'Version ID', $this->Node->VersionID), new ReadonlyField('NodeCreatedAt', 'Created At', $this->Node->CreatedAt), new ReadonlyField('NodeModifiedAt', 'Modified At', $this->Node->ChangedAt), new ReadonlyField('NodeUserID', 'User ID', $this->Node->UserID), new ReadonlyField('NodeStatus', 'Status', $this->Node->Status), new ReadonlyField('NodeLanguage', 'Language', $this->Node->Language), new ReadonlyField('NodeTitle', 'Title', $this->Node->Title), new ReadonlyField('NodeBody', 'Body', $this->Node->Body))); } // Import $fields->addFieldsToTab('Root.Import', array(new TextField('BaseUrl', 'Drupal Base URL'), new CheckboxField('ImportMedia', 'Import and rewrite references to Drupal media?', true), new TextField('FileRelation', 'Relation on Page to import attached files into'), new TextField('AssetsPath', 'Upload Drupal files to', 'Uploads/Drupal'))); if (class_exists('TaxonomyTerm')) { $fields->addFieldToTab('Root.Import', new TextField('TaxonomyRelation', 'Relation on Page to import taxonomy tags into')); } $fields->addFieldsToTab('Root.Import', array(new TextField('PageType', 'Page type to import into (leave blank for default)'), new CheckboxField('PublishOnImport', 'Publish pages after import?'), new CheckboxField('ImportPublishDates', 'Import created and last edited dates?'))); return $fields; }
public function getCMSFields() { $fields = parent::getCMSFields(); $categories = new TableListField('Categories', false, array('Label' => 'Label', 'Term' => 'Term', 'Scheme' => 'Scheme')); $categories->setCustomSourceItems($this->categories); $fields->addFieldsToTab('Root.Details', array(new HeaderField('CategoriesHeader', 'Categories', 4), $categories->performReadonlyTransformation())); $fields->addFieldsToTab('Root.Location', array(new ReadonlyField('Latitude', null, $this->Latitude), new ReadonlyField('Longitude', null, $this->Longitude))); $fields->addFieldToTab('Root.Behaviour', new ReadonlyField('ShowInMenus', null, $this->ShowInMenus)); return $fields; }
public function getCMSFields() { $fields = parent::getCMSFields(); $fields->addFieldToTab('Root.Details', new ReadonlyField('CategoryList', 'Categories', implode(', ', $this->Categories->map('Name', 'Name')))); $fields->addFieldsToTab('Root.Users', array(new ReadonlyField('UserID', 'User ID', $this->UserID), new ReadonlyField('Author', null, $this->Author), new ReadonlyField('AuthorID', 'Author ID', $this->AuthorID), new ReadonlyField('AuthorName', 'Author Name', $this->AuthorName))); $fields->addFieldsToTab('Root.Metadata', array(new ReadonlyField('Slug', null, $this->Slug), new ReadonlyField('Link', null, $this->Link), new ReadonlyField('Permalink', null, $this->Permalink))); $fields->addFieldsToTab('Root.Behaviour', array(new ReadonlyField('ParentID', 'Parent ID', $this->ParentID), new ReadonlyField('ParentTitle', 'Parent Title', $this->ParentTitle), new ReadonlyField('AllowComments', 'Allow Comments', $this->AllowComments), new ReadonlyField('AllowPings', 'Allow Pings', $this->AllowPings), new ReadonlyField('Password', null, $this->Password), new ReadonlyField('Template', null, $this->Template), new ReadonlyField('Order', null, $this->Order))); $fields->addFieldToTab('Root.CustomFields', $custom = new GridField('CustomFields', null, $this->CustomFields, new GridFieldConfig_RecordViewer())); $config = $custom->getConfig(); $config->removeComponentsByType('GridFieldFilterHeader'); $config->getComponentByType('GridFieldDataColumns')->setDisplayFields(array('ID' => 'ID', 'Key' => 'Key', 'Value' => 'Value')); return $fields; }
public function getCMSFields() { $fields = parent::getCMSFields(); $categoriesString = ''; foreach ($this->categories as $cat) { //$categoriesString .= "<li>$cat->Label / $cat->Term / $cat->Scheme</li> \n"; $categoriesString .= "<li>{$cat->Label}</li> \n"; } $categoriesString = "<ul>{$categoriesString}</ul>"; $fields->addFieldsToTab('Root.Main', array(new HeaderField('CategoriesHeader', 'Categories', 4), new LiteralField('Categories', $categoriesString))); $fields->addFieldsToTab('Root.Location', array(new ReadonlyField('Latitude', null, $this->Latitude), new ReadonlyField('Longitude', null, $this->Longitude))); $fields->addFieldToTab('Root.Behaviour', new ReadonlyField('ShowInMenus', null, $this->ShowInMenus)); return $fields; }
public function getCMSFields() { $fields = parent::getCMSFields(); $fields->removeByName('DrupalID'); $fields->removeByName('CreatedAt'); $fields->removeByName('ChangedAt'); $fields->removeByName('UserID'); $fields->removeByName('Status'); $fields->removeByName('Language'); $fields->removeByName('Title'); $fields->removeByName('Body'); $fields->addFieldsToTab('Root.Node', array(new ReadonlyField('DrupalID', 'Drupal Node ID', $this->DrupalID), new ReadonlyField('Title', 'Title', $this->Title), new ReadonlyField('Body', 'Body', $this->Body), new ReadonlyField('CreatedAt', 'Created Date', $this->CreatedAt), new ReadonlyField('ChangedAt', 'Modified Date', $this->ChangedAt), new ReadonlyField('UserID', 'UserID', $this->UserID), new ReadonlyField('Status', 'Status', $this->Status), new ReadonlyField('Language', 'Language', $this->Language))); return $fields; }
public function getCMSFields() { $fields = parent::getCMSFields(); $fields->addFieldToTab('Root.Details', new ReadonlyField('CategoryList', 'Categories', implode(', ', $this->Categories->map('Name', 'Name')))); $fields->addFieldsToTab('Root.Users', array(new ReadonlyField('UserID', 'User ID', $this->UserID), new ReadonlyField('AuthorID', 'Author ID', $this->AuthorID), new ReadonlyField('AuthorName', 'Author Name', $this->AuthorName))); $fields->addFieldsToTab('Root.Metadata', array(new ReadonlyField('Keywords', null, $this->Keywords), new ReadonlyField('Slug', null, $this->Slug), new ReadonlyField('Link', null, $this->Link), new ReadonlyField('Permalink', null, $this->Permalink))); $fields->addFieldsToTab('Root.Behaviour', array(new ReadonlyField('AllowComments', 'Allow Comments', $this->AllowComments), new ReadonlyField('AllowPings', 'Allow Pings', $this->AllowPings), new ReadonlyField('Password', null, $this->Password), new ReadonlyField('PostFormat', 'Post Format', $this->PostFormat), new ReadonlyField('Sticky', null, $this->Sticky))); $fields->addFieldToTab('Root.CustomFields', $custom = new GridField('CustomFields', null, $this->CustomFields, new GridFieldConfig_RecordViewer())); $config = $custom->getConfig(); $config->removeComponentsByType('GridFieldFilterHeader'); $config->getComponentByType('GridFieldDataColumns')->setDisplayFields(array('ID' => 'ID', 'Key' => 'Key', 'Value' => 'Value')); if (!class_exists('BlogEntry')) { $fields->addFieldToTab('Root.Import', new LiteralField('RequiresBlogImport', '<p>The Wordpress connector requires the blog module to import posts.</p>')); } return $fields; }
public function getCMSFields() { $fields = parent::getCMSFields(); // Add the preview fields here, including rules used $t = new StaticSitePageTransformer(); $urlField = new ReadonlyField("PreviewSourceURL", "Imported from", "<a href=\"{$this->AbsoluteURL}\">" . Convert::raw2xml($this->AbsoluteURL) . "</a>"); $urlField->dontEscape = true; $fields->addFieldToTab("Root.Preview", $urlField); $content = $t->getContentFieldsAndSelectors($this); if (count($content) === 0) { return $fields; } foreach ($content as $k => $v) { $readonlyField = new ReadonlyField("Preview{$k}", "{$k}<br>\n<em>" . $v['selector'] . "</em>", $v['content']); $readonlyField->addExtraClass('readonly-click-toggle'); $fields->addFieldToTab("Root.Preview", $readonlyField); } Requirements::javascript('staticsiteconnector/js/StaticSiteContentItem.js'); Requirements::css('staticsiteconnector/css/StaticSiteContentItem.css'); return $fields; }
public function getCMSFields() { $fields = parent::getCMSFields(); // Basic information $fields->fieldByName('Root.Main')->getChildren()->changeFieldOrder(array('TermName', 'Description')); $fields->addFieldToTab('Root.Main', new ReadonlyField('DrupalTermID', 'Term ID'), 'Name'); $fields->removeByName('Parents'); // Details $parentsText = '(none)'; $parents = $this->Parents->toMap(); if ($parents) { $parentsText = ''; foreach ($parents as $key => $value) { $parentsText .= "{$value}, "; } $parentsText = substr($parentsText, 0, -2); } $fields->addFieldToTab('Root.Details', new ReadonlyField('ParentList', 'Parents', $parentsText)); $fields->addFieldsToTab('Root.Behaviour', array(new ReadonlyField('VocabularyID', 'VocabularyID', $this->VocabularyID), new ReadonlyField('External', 'External', $this->External), new ReadonlyField('HasChildren', 'HasChildren', $this->HasChildren), new ReadonlyField('Weight', 'Weight', $this->Weight), new ReadonlyField('Depth', 'Depth', $this->Depth))); return $fields; }
public function getCMSFields() { $fields = parent::getCMSFields(); // Basic information $fields->fieldByName('Root.Main')->getChildren()->changeFieldOrder(array('MenuTitle', 'Description', 'Path', 'Href')); $fields->addFieldToTab('Root.Main', new ReadonlyField('DrupalMenuLinkID', 'Menu Link ID'), 'Title'); $fields->removeByName('Options'); // Details $optionsText = '(none)'; $options = $this->Options->toMap(); if ($options) { $optionsText = ''; foreach ($options as $key => $value) { $optionsText .= "{$key} = {$value}, "; } $optionsText = substr($optionsText, 0, -2); } $fields->addFieldToTab('Root.Details', new ReadonlyField('OptionList', 'Options', $optionsText)); $fields->addFieldsToTab('Root.Behaviour', array(new ReadonlyField('Hidden', 'Hidden', $this->Hidden), new ReadonlyField('External', 'External', $this->External), new ReadonlyField('HasChildren', 'HasChildren', $this->HasChildren), new ReadonlyField('Weight', 'Weight', $this->Weight), new ReadonlyField('Depth', 'Depth', $this->Depth))); return $fields; }