Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- *
- */
- class RamsheadYoutube extends SiteTree{
- //THIS PAGE CAN NOT BE CREATED AS A TOP LEVEL PAGE
- static $can_be_root = false;
- //ALLOWED CHILD PAGES
- static $allowed_children = "none";
- //
- static $db = array (
- 'Title' => 'Text',
- 'YoutubeID' => 'Text'
- );
- //
- static $has_one = array(
- );
- //
- static $defaults = array (
- 'ShowInMenus' => false,
- 'ShowInSearch' => false
- );
- /**/
- function getCMSFields(){
- $fields = parent::getCMSFields();
- //REMOVE FIELDS THAT ARE NOT NEEDED
- $fields->removeByName('Metadata');
- $fields->removeByName('GoogleSitemap');
- $fields->removeFieldFromTab('Root.Content.Main', 'MenuTitle');
- $fields->removeFieldFromTab("Root.Content.Main", "Content");
- //
- $fields->addFieldToTab("Root.Content.Main", new TextField('Title', 'Title'));
- $fields->addFieldToTab("Root.Content.Main", new TextField('YoutubeID', 'Youtube ID'));
- return $fields;
- }
- }
- /**/
- class RamsheadYoutube_Controller extends ContentController{
- /**/
- public static $allowed_actions = array(
- );
- /**/
- public function init(){
- parent::init();
- //
- if( $this->dataRecord->hasExtension('Translatable') ){
- i18n::set_locale($this->dataRecord->Locale);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement