public function getCMSFields()
 {
     $message = sprintf('<p>%s</p><p><a href="%2$s">%2$s</a></p>', _t('ElementVirtualLinked.DESCRIBE', 'This is a virtual copy of a block. To edit, visit'), $this->LinkedElement()->getEditLink());
     $fields = new FieldList(new TabSet('Root', $main = new Tab('Main')));
     if ($this->isInvalidPublishState()) {
         $warning = 'Error: The original block is not published. This block will not work on the live site until you click the link below and publish it.';
         $main->push(new LiteralField('WarningHeader', '<p class="message error">' . $warning . '</p>'));
     }
     $main->push(new LiteralField('Existing', $message));
     $this->extend('updateCMSFields', $fields);
     return $fields;
 }
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $fields->addFieldToTab("Root", $subscriptionTab = new Tab(_t('Newsletter.SUBSCRIPTIONFORM', 'SubscriptionForm')));
     Requirements::javascript('newsletter/javascript/SubscriptionPage.js');
     Requirements::css('newsletter/css/SubscriptionPage.css');
     $subscriptionTab->push(new HeaderField("SubscriptionFormConfig", _t('Newsletter.SUBSCRIPTIONFORMCONFIGURATION', "Subscription Form Configuration")));
     $subscriptionTab->push(new TextField('CustomisedHeading', 'Heading at the top of the form'));
     //Fields selction
     $frontFields = singleton('Recipient')->getFrontEndFields()->dataFields();
     $fieldCandidates = array();
     if (count($frontFields)) {
         foreach ($frontFields as $fieldName => $dataField) {
             $fieldCandidates[$fieldName] = $dataField->Title() ? $dataField->Title() : $dataField->Name();
         }
     }
     //Since Email field is the Recipient's identifier,
     //and newsletters subscription is non-sence if no email is given by the user,
     //we should force that email to be checked and required.
     //FisrtName should be checked as default, though it might not be required
     $defaults = array("Email", "FirstName");
     $extra = array('CustomLabel' => "Varchar", "ValidationMessage" => "Varchar", "Required" => "Boolean");
     $extraValue = array('CustomLabel' => $this->CustomLabel, "ValidationMessage" => $this->ValidationMessage, "Required" => $this->Required);
     $subscriptionTab->push($fieldsSelection = new CheckboxSetWithExtraField("Fields", _t('Newsletter.SelectFields', "Select the fields to display on the subscription form"), $fieldCandidates, $extra, $defaults, $extraValue));
     $fieldsSelection->setCellDisabled(array("Email" => array("Value", "Required")));
     //Mailing Lists selection
     $mailinglists = MailingList::get();
     $newsletterSelection = $mailinglists && $mailinglists->count() ? new CheckboxSetField("MailingLists", _t("Newsletter.SubscribeTo", "Newsletters to subscribe to"), $mailinglists->map('ID', 'FullTitle'), $mailinglists) : new LiteralField("NoMailingList", sprintf('<p>%s</p>', sprintf('You haven\'t defined any mailing list yet, please go to ' . '<a href=\\"%s\\">the newsletter administration area</a> ' . 'to define a mailing list.', singleton('NewsletterAdmin')->Link())));
     $subscriptionTab->push($newsletterSelection);
     $subscriptionTab->push(new TextField("SubmissionButtonText", "Submit Button Text"));
     $subscriptionTab->push(new LiteralField('BottomTaskSelection', sprintf('<div id="SendNotificationControlls" class="field actions">' . '<label class="left">%s</label>' . '<ul><li class="ss-ui-button no" data-panel="no">%s</li>' . '<li class="ss-ui-button yes" data-panel="yes">%s</li>' . '</ul></div>', _t('Newsletter.SendNotif', 'Send notification email to the subscriber'), _t('Newsletter.No', 'No'), _t('Newsletter.Yes', 'Yes'))));
     $subscriptionTab->push(CompositeField::create(new HiddenField("SendNotification", "Send Notification"), new TextField("NotificationEmailSubject", _t('Newsletter.NotifSubject', "Notification Email Subject Line")), new TextField("NotificationEmailFrom", _t('Newsletter.FromNotif', "From Email Address for Notification Email")))->addExtraClass('SendNotificationControlledPanel'));
     $subscriptionTab->push(new HtmlEditorField('OnCompleteMessage', _t('Newsletter.OnCompletion', 'Message shown on subscription completion')));
     return $fields;
 }
 public function getCMSFields()
 {
     $fields = new FieldList();
     $imageTab = new Tab('Image');
     $seoTab = new Tab('Metadata');
     $tabset = new TabSet("Root", $imageTab, $seoTab);
     $fields->push($tabset);
     $image_field = new UploadField("FullsizeImage", "Image");
     $image_field->setAllowedFileCategories('image');
     $imageTab->push($image_field);
     $imageTab->push(new TextField("Alt", "Image Alt Tag"));
     $imageTab->push(new TextField("Title"));
     $imageTab->push(new HTMLEditorField("Description"));
     $seoTab->push(new TextField("MetaTitle", "Meta Title"));
     $seoTab->push(new TextField("MetaKeywords", "Meta Keywords"));
     $seoTab->push(new TextAreaField("MetaDescription", "Meta Description"));
     return $fields;
 }
Exemple #4
0
 /**
  * Returns a FieldSet with which to create the CMS editing form.
  * You can use the extend() method of FieldSet to create customised forms for your other
  * data objects.
  */
 function getCMSFields($controller = null)
 {
     require_once "forms/Form.php";
     $group = DataObject::get_by_id("Group", $this->Parent()->GroupID);
     $sent_status_report = $this->renderWith("Newsletter_SentStatusReport");
     $ret = new FieldSet(new TabSet("Root", $mailTab = new Tab(_t('Newsletter.NEWSLETTER', 'Newsletter'), new TextField("Subject", _t('Newsletter.SUBJECT', 'Subject'), $this->Subject), new HtmlEditorField("Content", _t('Newsletter.CONTENT', 'Content'))), $sentToTab = new Tab(_t('Newsletter.SENTREPORT', 'Sent Status Report'), new LiteralField("Sent Status Report", $sent_status_report))));
     if ($this->Status != 'Draft') {
         $mailTab->push(new ReadonlyField("SendDate", _t('Newsletter.SENTAT', 'Sent at'), $this->SendDate));
     }
     return $ret;
 }
 /**
  * Returns a FieldSet with which to create the CMS editing form.
  * You can use the extend() method of FieldSet to create customised forms for your other
  * data objects.
  *
  * @param Controller
  * @return FieldSet
  */
 function getCMSFields($controller = null)
 {
     $group = DataObject::get_by_id("Group", $this->Parent()->GroupID);
     $sentReport = $this->renderWith("Newsletter_SentStatusReport");
     $previewLink = Director::absoluteBaseURL() . 'admin/newsletter/preview/' . $this->ID;
     $trackedLinks = $this->renderWith("Newsletter_TrackedLinksReport");
     $ret = new FieldSet(new TabSet("Root", $mailTab = new Tab(_t('Newsletter.NEWSLETTER', 'Newsletter'), new TextField("Subject", _t('Newsletter.SUBJECT', 'Subject'), $this->Subject), new HtmlEditorField("Content", _t('Newsletter.CONTENT', 'Content')), new LiteralField('PreviewNewsletter', "<a href=\"{$previewLink}\" target=\"_blank\">" . _t('PREVIEWNEWSLETTER', 'Preview this newsletter') . "</a>")), $sentToTab = new Tab(_t('Newsletter.SENTREPORT', 'Sent Status Report'), new LiteralField("SentStatusReport", $sentReport)), $trackLink = new Tab(_t('Newsletter.TRACKEDLINKS', 'Tracked Links'), new LiteralField("TrackedLinks", $trackedLinks))));
     if ($this->Status != 'Draft') {
         $mailTab->push(new ReadonlyField("SentDate", _t('Newsletter.SENTAT', 'Sent at'), $this->SentDate));
     }
     $this->extend("updateCMSFields", $ret);
     return $ret;
 }
 function updateCMSFields(FieldList $fields)
 {
     $fields->insertAfter($tabset = new TabSet('ColoredImages'), 'Image');
     $tabset->push($uploadtab = new Tab('UploadImages'));
     $tabset->push($attributetab = new Tab('AssignAttribute'));
     $uploadtab->push($uf = new UploadField('Images', 'Images'));
     $uf->setDescription('Note: The product must be saved before attributes can be assigned to new uploaded images.');
     $attributetab->push($gf = GridField::create("ImageAttributes", "Images", $this->owner->Images(), GridFieldConfig_RelationEditor::create()->removeComponentsByType("GridFieldAddNewButton")->removeComponentsByType("GridFieldEditButton")->removeComponentsByType("GridFieldDataColumns")->removeComponentsByType("GridFieldDeleteAction")->addComponent($cols = new GridFieldEditableColumns())->addComponent(new GridFieldOrderableRows('Sort'))));
     $displayfields = array('Title' => array('title' => 'Title', 'field' => new ReadonlyField("Name")));
     //add drop-down color selection
     $colors = $this->owner->getColors();
     if ($colors->exists()) {
         $displayfields['ColorID'] = function ($record, $col, $grid) use($colors) {
             return DropdownField::create($col, "Color", $colors->map('ID', 'Value')->toArray())->setHasEmptyDefault(true);
         };
     }
     $cols->setDisplayFields($displayfields);
 }
 public function updateCMSFields(FieldList $fields)
 {
     $fields->removeByName('FlexiFormFields');
     $fields->removeByName('FlexiFormConfigID');
     if ($this->owner->exists()) {
         $fields_tab = new Tab('Fields');
         $settings_tab = new Tab('Settings');
         $fields->addFieldToTab($this->getFlexiFormTab(), $flexi_tabs = new TabSet('flexiform', $fields_tab, $settings_tab), $this->getFlexiFormInsertBefore());
         // Fields
         /////////
         $field_types = array();
         foreach ($this->getFlexiFormFieldTypes() as $className) {
             $singleton = singleton($className);
             if ($singleton->canCreate(Member::currentUser())) {
                 $field_types[$className] = "{$singleton->Label()}";
             }
         }
         $config = new GridFieldConfig_FlexiForm();
         $component = $config->getComponentByType('GridFieldAddNewMultiClass');
         $component->setTitle($this->getFlexiFormAddButton());
         $component->setClasses($field_types);
         // hint allowed types to FlexiFormField search fields
         singleton('FlexiFormField')->set_stat('allowed_types', $field_types);
         $component = $config->getComponentByType('GridFieldAddExistingSearchButton');
         $component->setSearchList(FlexiFormField::get()->filter('ClassName', array_keys($field_types)));
         $fields_tab->push(new GridField('FlexiForm', 'Form Fields', $this->owner->FlexiFormFields(), $config));
         // Settings
         ///////////
         $settings_tab->push(new HiddenField('FlexiFormConfigs'));
         // trigger setFlexiFormConfigs method
         $settings_tab->push(new TextField('FlexiFormConfig[FormIdentifier]', 'Form Identifier', $this->FlexiFormConf('FormIdentifier')));
         $settings_tab->push(new DropdownField('FlexiFormConfig[HandlerID]', 'Form Handler', FlexiFormHandler::get()->map(), $this->FlexiFormConf('HandlerID')));
         $field = new ToggleCompositeField('ManageHandlers', 'Manage Handlers', array(new GridField('FlexiHandlers', 'Handlers', FlexiFormHandler::get(), new GridFieldConfig_FlexiFormHandler())));
         $settings_tab->push($field);
         // Handler-specific Fields
         //////////////////////////
         $handler = $this->FlexiFormHandler();
         if ($handler->exists()) {
             $handler->updateCMSFlexiTabs($flexi_tabs, $settings_tab, $this->owner);
         }
     } else {
         $fields->addFieldToTab($this->getFlexiFormTab(), new LiteralField('FlexiForm', '<p>Please save before editing the form.</p>'));
     }
 }
 public function updateCMSFields(FieldList $fields)
 {
     /** @var Page|MapaelCountryPageExtension $page */
     $page = $this->getOwner();
     $labels = $page->fieldLabels();
     $name = MapaelCountryPage::create()->i18n_singular_name();
     $tab = $fields->findOrMakeTab('Root.CountryPageTab', $name);
     $tab->push(new TabSet('CountryPageTabSet', $main = new Tab('CountryPageMain', _t('CMSMain.TabContent', 'Content')), $cities = new Tab('CountryPageCities', $page->fieldLabel('MapaelCities'))));
     $arr = array();
     foreach (MapaelMap::getAreasArray() as $code => $attrs) {
         $arr[$code] = $attrs['tooltip']['content'];
     }
     $main->push($dd = new CountryDropdownField('CountryCode', $page->fieldLabel('CountryCode'), $arr, $page->CountryCode));
     $dd->setEmptyString(_t(__CLASS__ . '.CountryCodeNone', 'None'));
     $main->push($tf = self::getTooltipContentField($page));
     $tf->setDescription(MapaelMap::getCountryName($page->CountryCode));
     $main->push(self::getTargetField($page));
     $main->push(self::getHrefField($page));
     if ($page->CountryHolderPageID) {
         $main->push(new ReadonlyField('CountryHolderPageReadonly', $page->fieldLabel('CountryHolderPage'), $page->CountryHolderPage()->Title));
     }
     $cities->push(GridField::create('MapaelCities', $page->fieldLabel('MapaelCities'), $page->MapaelCities(), GridFieldConfig_RelationEditor::create()));
 }
 function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $fields->addFieldToTab("Root.Content", $subscriptionTab = new Tab(_t('Newsletter.SUBSCRIPTIONFORM', 'SubscriptionForm')));
     $subscriptionTab->push(new HeaderField("SubscriptionFormConfig", _t('Newsletter.SUBSCRIPTIONFORMCONFIGURATIONS', "Subscription Form Configurations")));
     //Fields selction
     $dataFields = singleton('Member')->getCMSFields()->dataFields();
     //Since the subscription form is focuse add a member to newsletter groups, we should avoid Password stuff and leave it to member forget/reset password mechanism.
     if (isset($dataFields['Password'])) {
         unset($dataFields['Password']);
     }
     $fieldCandidates = array();
     if (count($dataFields)) {
         foreach ($dataFields as $fieldName => $dataField) {
             $fieldCandidates[$fieldName] = $dataField->Title() ? $dataField->Title() : $dataField->Name();
         }
     }
     $memberFields = singleton('Member')->getMemberFormFields()->dataFields();
     //Since Email field is the member's identifier, and newsletters subscription is non-sence if no email is given by the user, we should force that email to be checked and required.
     $defaults = array("Email");
     if (count($memberFields)) {
         foreach ($memberFields as $fieldName => $memberField) {
             $defaults[] = $fieldName;
         }
     }
     $extra = array('CustomisedLables' => "Varchar", "CustomisedErrors" => "Varchar", "Required" => "Boolean");
     $extraValue = array('CustomisedLables' => $this->CustomisedLables, "CustomisedErrors" => $this->CustomisedErrors, "Required" => $this->Required);
     $subscriptionTab->push($fieldsSelection = new CheckboxSetWithExtraField("Fields", "<h4>Select the fields that you want to appearing in the subscription form</h4>", $fieldCandidates, $extra, $defaults));
     $fieldsSelection->setCellDisabled(array("Email" => array("Value", "Required")));
     //NewsletterTypes selection
     $newsletterTypes = DataObject::get("NewsletterType");
     $newsletterSelection = $newsletterTypes ? new CheckboxSetField("NewsletterTypes", "<h4>Select the newsletters that you want the user subscript to</h4>", $newsletterTypes, $newsletterTypes) : new LiteralField("NoNewsletters", "<p>You haven't define any newsletter yet, please go to <a href=\"admin/newsletter\">newsletter</a> to define some newsletter types</p>");
     $subscriptionTab->push($newsletterSelection);
     $subscriptionTab->push(new TextField("SubmissionButtonText", "Text appearing in the submit button"));
     $subscriptionTab->push(new ToggleCompositeField("SendNotificationToggle", "Send notification email to the subscriber?", new SelectionGroup("SendNotification", array("0//no" => new CompositeField(), "1//yes" => new FieldGroup(new TextField("NotificationEmailSubject", "Notification Email Subject Line:"), new TextField("NotificationEmailFrom", "From Email Address for Notification Email"))))));
     $subscriptionTab->push(new HtmlEditorField('OnCompleteMessage', "<h3>Message shown on completion</h3>"));
     return $fields;
 }
 function testRootFieldSet()
 {
     /* Given a nested set of FormField, CompositeField, and FieldSet objects */
     $fieldSet = new FieldSet($root = new TabSet("Root", $main = new Tab("Main", $a = new TextField("A"), $b = new TextField("B"))));
     /* rootFieldSet() should always evaluate to the same object: the topmost fieldset */
     $this->assertSame($fieldSet, $fieldSet->rootFieldSet());
     $this->assertSame($fieldSet, $root->rootFieldSet());
     $this->assertSame($fieldSet, $main->rootFieldSet());
     $this->assertSame($fieldSet, $a->rootFieldSet());
     $this->assertSame($fieldSet, $b->rootFieldSet());
     /* If we push additional fields, they should also have the same rootFieldSet() */
     $root->push($other = new Tab("Other"));
     $other->push($c = new TextField("C"));
     $root->push($third = new Tab("Third", $d = new TextField("D")));
     $this->assertSame($fieldSet, $other->rootFieldSet());
     $this->assertSame($fieldSet, $third->rootFieldSet());
     $this->assertSame($fieldSet, $c->rootFieldSet());
     $this->assertSame($fieldSet, $d->rootFieldSet());
 }
Exemple #11
0
 public function getEditForm($id = null, $fields = null)
 {
     $form = parent::getEditForm($id, $fields);
     $folder = $id && is_numeric($id) ? DataObject::get_by_id('Folder', $id, false) : $this->currentPage();
     $fields = $form->Fields();
     $title = $folder && $folder->exists() ? $folder->Title : _t('AssetAdmin.FILES', 'Files');
     $fields->push(new HiddenField('ID', false, $folder ? $folder->ID : null));
     // File listing
     $gridFieldConfig = GridFieldConfig::create()->addComponents(new GridFieldToolbarHeader(), new GridFieldSortableHeader(), new GridFieldFilterHeader(), new GridFieldDataColumns(), new GridFieldPaginator(self::config()->page_length), new GridFieldEditButton(), new GridFieldDeleteAction(), new GridFieldDetailForm(), GridFieldLevelup::create($folder->ID)->setLinkSpec('admin/assets/show/%d'));
     $gridField = GridField::create('File', $title, $this->getList(), $gridFieldConfig);
     $columns = $gridField->getConfig()->getComponentByType('GridFieldDataColumns');
     $columns->setDisplayFields(array('StripThumbnail' => '', 'Title' => _t('File.Title', 'Title'), 'Created' => _t('AssetAdmin.CREATED', 'Date'), 'Size' => _t('AssetAdmin.SIZE', 'Size')));
     $columns->setFieldCasting(array('Created' => 'SS_Datetime->Nice'));
     $gridField->setAttribute('data-url-folder-template', Controller::join_links($this->Link('show'), '%s'));
     if ($folder->canCreate()) {
         $uploadBtn = new LiteralField('UploadButton', sprintf('<a class="ss-ui-button ss-ui-action-constructive cms-panel-link" data-pjax-target="Content" data-icon="drive-upload" href="%s">%s</a>', Controller::join_links(singleton('CMSFileAddController')->Link(), '?ID=' . $folder->ID), _t('Folder.UploadFilesButton', 'Upload')));
     } else {
         $uploadBtn = null;
     }
     if (!$folder->hasMethod('canAddChildren') || $folder->hasMethod('canAddChildren') && $folder->canAddChildren()) {
         // TODO Will most likely be replaced by GridField logic
         $addFolderBtn = new LiteralField('AddFolderButton', sprintf('<a class="ss-ui-button ss-ui-action-constructive cms-add-folder-link" data-icon="add" data-url="%s" href="%s">%s</a>', Controller::join_links($this->Link('AddForm'), '?' . http_build_query(array('action_doAdd' => 1, 'ParentID' => $folder->ID, 'SecurityID' => $form->getSecurityToken()->getValue()))), Controller::join_links($this->Link('addfolder'), '?ParentID=' . $folder->ID), _t('Folder.AddFolderButton', 'Add folder')));
     } else {
         $addFolderBtn = '';
     }
     if ($folder->canEdit()) {
         $syncButton = new LiteralField('SyncButton', sprintf('<a class="ss-ui-button ss-ui-action ui-button-text-icon-primary ss-ui-button-ajax" data-icon="arrow-circle-double" title="%s" href="%s">%s</a>', _t('AssetAdmin.FILESYSTEMSYNCTITLE', 'Update the CMS database entries of files on the filesystem. Useful when new files have been uploaded outside of the CMS, e.g. through FTP.'), $this->Link('doSync'), _t('AssetAdmin.FILESYSTEMSYNC', 'Sync files')));
     } else {
         $syncButton = null;
     }
     // Move existing fields to a "details" tab, unless they've already been tabbed out through extensions.
     // Required to keep Folder->getCMSFields() simple and reuseable,
     // without any dependencies into AssetAdmin (e.g. useful for "add folder" views).
     if (!$fields->hasTabset()) {
         $tabs = new TabSet('Root', $tabList = new Tab('ListView', _t('AssetAdmin.ListView', 'List View')), $tabTree = new Tab('TreeView', _t('AssetAdmin.TreeView', 'Tree View')));
         $tabList->addExtraClass("content-listview cms-tabset-icon list");
         $tabTree->addExtraClass("content-treeview cms-tabset-icon tree");
         if ($fields->Count() && $folder->exists()) {
             $tabs->push($tabDetails = new Tab('DetailsView', _t('AssetAdmin.DetailsView', 'Details')));
             $tabDetails->addExtraClass("content-galleryview cms-tabset-icon edit");
             foreach ($fields as $field) {
                 $fields->removeByName($field->getName());
                 $tabDetails->push($field);
             }
         }
         $fields->push($tabs);
     }
     // we only add buttons if they're available. User might not have permission and therefore
     // the button shouldn't be available. Adding empty values into a ComposteField breaks template rendering.
     $actionButtonsComposite = CompositeField::create()->addExtraClass('cms-actions-row');
     if ($uploadBtn) {
         $actionButtonsComposite->push($uploadBtn);
     }
     if ($addFolderBtn) {
         $actionButtonsComposite->push($addFolderBtn);
     }
     if ($syncButton) {
         $actionButtonsComposite->push($syncButton);
     }
     // List view
     $fields->addFieldsToTab('Root.ListView', array($actionsComposite = CompositeField::create($actionButtonsComposite)->addExtraClass('cms-content-toolbar field'), $gridField));
     $treeField = new LiteralField('Tree', '');
     // Tree view
     $fields->addFieldsToTab('Root.TreeView', array(clone $actionsComposite, new LiteralField('Tree', FormField::create_tag('div', array('class' => 'cms-tree', 'data-url-tree' => $this->Link('getsubtree'), 'data-url-savetreenode' => $this->Link('savetreenode')), $this->SiteTreeAsUL()))));
     // Move actions to "details" tab (they don't make sense on list/tree view)
     $actions = $form->Actions();
     $saveBtn = $actions->fieldByName('action_save');
     $deleteBtn = $actions->fieldByName('action_delete');
     $actions->removeByName('action_save');
     $actions->removeByName('action_delete');
     if (($saveBtn || $deleteBtn) && $fields->fieldByName('Root.DetailsView')) {
         $fields->addFieldToTab('Root.DetailsView', CompositeField::create($saveBtn, $deleteBtn)->addExtraClass('Actions'));
     }
     $fields->setForm($form);
     $form->setTemplate($this->getTemplatesWithSuffix('_EditForm'));
     // TODO Can't merge $FormAttributes in template at the moment
     $form->addExtraClass('cms-edit-form cms-panel-padded center ' . $this->BaseCSSClasses());
     $form->setAttribute('data-pjax-fragment', 'CurrentForm');
     $form->Fields()->findOrMakeTab('Root')->setTemplate('CMSTabSet');
     $this->extend('updateEditForm', $form);
     return $form;
 }
 public function getEditForm($id = null, $fields = null)
 {
     Requirements::javascript(FRAMEWORK_DIR . '/javascript/AssetUploadField.js');
     Requirements::css(FRAMEWORK_DIR . '/css/AssetUploadField.css');
     $form = parent::getEditForm($id, $fields);
     $folder = $id && is_numeric($id) ? DataObject::get_by_id('Folder', $id, false) : $this->currentPage();
     $fields = $form->Fields();
     $title = $folder && $folder->exists() ? $folder->Title : _t('AssetAdmin.FILES', 'Files');
     $fields->push(new HiddenField('ID', false, $folder ? $folder->ID : null));
     // File listing
     $gridFieldConfig = GridFieldConfig::create()->addComponents(new GridFieldToolbarHeader(), new GridFieldSortableHeader(), new GridFieldFilterHeader(), new GridFieldDataColumns(), new GridFieldPaginator(self::config()->page_length), new GridFieldEditButton(), new GridFieldDeleteAction(), new GridFieldDetailForm(), GridFieldLevelup::create($folder->ID)->setLinkSpec('admin/assets/show/%d'));
     $gridField = GridField::create('File', $title, $this->getList(), $gridFieldConfig);
     $columns = $gridField->getConfig()->getComponentByType('GridFieldDataColumns');
     $columns->setDisplayFields(array('StripThumbnail' => '', 'Title' => _t('File.Title', 'Title'), 'Created' => _t('AssetAdmin.CREATED', 'Date'), 'Size' => _t('AssetAdmin.SIZE', 'Size')));
     $columns->setFieldCasting(array('Created' => 'SS_Datetime->Nice'));
     $gridField->setAttribute('data-url-folder-template', Controller::join_links($this->Link('show'), '%s'));
     if (!$folder->hasMethod('canAddChildren') || $folder->hasMethod('canAddChildren') && $folder->canAddChildren()) {
         // TODO Will most likely be replaced by GridField logic
         $addFolderBtn = new LiteralField('AddFolderButton', sprintf('<a class="ss-ui-button font-icon-folder-add no-text cms-add-folder-link" title="%s" data-icon="add" data-url="%s" href="%s"></a>', _t('Folder.AddFolderButton', 'Add folder'), Controller::join_links($this->Link('AddForm'), '?' . http_build_query(array('action_doAdd' => 1, 'ParentID' => $folder->ID, 'SecurityID' => $form->getSecurityToken()->getValue()))), Controller::join_links($this->Link('addfolder'), '?ParentID=' . $folder->ID)));
     } else {
         $addFolderBtn = '';
     }
     // Move existing fields to a "details" tab, unless they've already been tabbed out through extensions.
     // Required to keep Folder->getCMSFields() simple and reuseable,
     // without any dependencies into AssetAdmin (e.g. useful for "add folder" views).
     if (!$fields->hasTabset()) {
         $tabs = new TabSet('Root', $tabList = new Tab('ListView', _t('AssetAdmin.ListView', 'List View')), $tabTree = new Tab('TreeView', _t('AssetAdmin.TreeView', 'Tree View')));
         $tabList->addExtraClass("content-listview cms-tabset-icon list");
         $tabTree->addExtraClass("content-treeview cms-tabset-icon tree");
         if ($fields->Count() && $folder->exists()) {
             $tabs->push($tabDetails = new Tab('DetailsView', _t('AssetAdmin.DetailsView', 'Details')));
             $tabDetails->addExtraClass("content-galleryview cms-tabset-icon edit");
             foreach ($fields as $field) {
                 $fields->removeByName($field->getName());
                 $tabDetails->push($field);
             }
         }
         $fields->push($tabs);
     }
     // we only add buttons if they're available. User might not have permission and therefore
     // the button shouldn't be available. Adding empty values into a ComposteField breaks template rendering.
     $actionButtonsComposite = CompositeField::create()->addExtraClass('cms-actions-row');
     if ($addFolderBtn) {
         $actionButtonsComposite->push($addFolderBtn);
     }
     // Add the upload field for new media
     if ($currentPageID = $this->currentPageID()) {
         Session::set("{$this->class}.currentPage", $currentPageID);
     }
     $folder = $this->currentPage();
     $uploadField = UploadField::create('AssetUploadField', '');
     $uploadField->setConfig('previewMaxWidth', 40);
     $uploadField->setConfig('previewMaxHeight', 30);
     $uploadField->setConfig('changeDetection', false);
     $uploadField->addExtraClass('ss-assetuploadfield');
     $uploadField->removeExtraClass('ss-uploadfield');
     $uploadField->setTemplate('AssetUploadField');
     if ($folder->exists()) {
         $path = $folder->getFilename();
         $uploadField->setFolderName($path);
     } else {
         $uploadField->setFolderName('/');
         // root of the assets
     }
     $exts = $uploadField->getValidator()->getAllowedExtensions();
     asort($exts);
     $uploadField->Extensions = implode(', ', $exts);
     // List view
     $fields->addFieldsToTab('Root.ListView', array($actionsComposite = CompositeField::create($actionButtonsComposite)->addExtraClass('cms-content-toolbar field'), $uploadField, new HiddenField('ID'), $gridField));
     // Tree view
     $fields->addFieldsToTab('Root.TreeView', array(clone $actionsComposite, new LiteralField('Tree', FormField::create_tag('div', array('class' => 'cms-tree', 'data-url-tree' => $this->Link('getsubtree'), 'data-url-savetreenode' => $this->Link('savetreenode')), $this->SiteTreeAsUL()))));
     // Move actions to "details" tab (they don't make sense on list/tree view)
     $actions = $form->Actions();
     $saveBtn = $actions->fieldByName('action_save');
     $deleteBtn = $actions->fieldByName('action_delete');
     $actions->removeByName('action_save');
     $actions->removeByName('action_delete');
     if (($saveBtn || $deleteBtn) && $fields->fieldByName('Root.DetailsView')) {
         $fields->addFieldToTab('Root.DetailsView', CompositeField::create($saveBtn, $deleteBtn)->addExtraClass('Actions'));
     }
     $fields->setForm($form);
     $form->setTemplate($this->getTemplatesWithSuffix('_EditForm'));
     // TODO Can't merge $FormAttributes in template at the moment
     $form->addExtraClass('cms-edit-form ' . $this->BaseCSSClasses());
     $form->setAttribute('data-pjax-fragment', 'CurrentForm');
     $form->Fields()->findOrMakeTab('Root')->setTemplate('CMSTabSet');
     $this->extend('updateEditForm', $form);
     return $form;
 }
 /**
  * @inheritdoc
  */
 public function push(FormField $field)
 {
     return $this->tab->push($field);
 }
 /**
  * Get the pop-up fields for the given record.
  */
 function getCustomFieldsFor($childData)
 {
     if (!$childData) {
         user_error("AssetTableField::DetailForm No record found");
         return null;
     }
     if ($childData->ParentID) {
         $folder = DataObject::get_by_id('File', $childData->ParentID);
     } else {
         $folder = singleton('Folder');
     }
     $urlLink = "<div class='field readonly'>";
     $urlLink .= "<label class='left'>" . _t('AssetTableField.URL', 'URL') . "</label>";
     $urlLink .= "<span class='readonly'><a href='{$childData->Link()}'>{$childData->RelativeLink()}</a></span>";
     $urlLink .= "</div>";
     $detailFormFields = new FieldSet(new TabSet("BottomRoot", $mainTab = new Tab('Main', new TextField("Title", _t('AssetTableField.TITLE', 'Title')), new TextField("Name", _t('AssetTableField.FILENAME', 'Filename')), new LiteralField("AbsoluteURL", $urlLink), new ReadonlyField("FileType", _t('AssetTableField.TYPE', 'Type')), new ReadonlyField("Size", _t('AssetTableField.SIZE', 'Size'), $childData->getSize()), new DropdownField("OwnerID", _t('AssetTableField.OWNER', 'Owner'), Member::mapInCMSGroups()), new DateField_Disabled("Created", _t('AssetTableField.CREATED', 'First uploaded')), new DateField_Disabled("LastEdited", _t('AssetTableField.LASTEDIT', 'Last changed')))));
     $mainTab->setTitle(_t('AssetTableField.MAIN', 'Main'));
     if (is_a($childData, 'Image')) {
         $tab = $detailFormFields->findOrMakeTab("BottomRoot.Image", _t('AssetTableField.IMAGE', 'Image'));
         $big = $childData->URL;
         $formattedImage = $childData->getFormattedImage('AssetLibraryPreview');
         $thumbnail = $formattedImage ? $formattedImage->URL : '';
         // Hmm this required the translated string to be appended to BottomRoot to add this to the Main tab
         $detailFormFields->addFieldToTab('BottomRoot.Main', new ReadonlyField("Dimensions", _t('AssetTableField.DIM', 'Dimensions')));
         $tab->push(new LiteralField("ImageFull", "<img id='thumbnailImage' src='{$thumbnail}?r=" . rand(1, 100000) . "' alt='{$childData->Name}' />"));
     }
     if (!$childData instanceof Folder) {
         $mainTab->push(new CheckboxField("ShowInSearch", $childData->fieldLabel('ShowInSearch')));
     }
     if ($childData && $childData->hasMethod('BackLinkTracking')) {
         if (class_exists('Subsite')) {
             Subsite::disable_subsite_filter(true);
         }
         $links = $childData->BackLinkTracking();
         if (class_exists('Subsite')) {
             Subsite::disable_subsite_filter(false);
         }
         if ($links && $links->exists()) {
             $backlinks = array();
             foreach ($links as $link) {
                 $backlinks[] = "<li><a href=\"admin/show/{$link->ID}\">" . $link->Breadcrumbs(null, true) . "</a></li>";
             }
             $backlinks = "<div style=\"clear:left\">" . _t('AssetTableField.PAGESLINKING', 'The following pages link to this file:') . "<ul>" . implode("", $backlinks) . "</ul></div>";
         }
         if (!isset($backlinks)) {
             $backlinks = "<p>" . _t('AssetTableField.NOLINKS', "This file hasn't been linked to from any pages.") . "</p>";
         }
         $detailFormFields->addFieldToTab("BottomRoot.Links", new LiteralField("Backlinks", $backlinks));
     }
     // the ID field confuses the Controller-logic in finding the right view for ReferencedField
     $detailFormFields->removeByName('ID');
     if ($childData) {
         $childData->extend('updateCMSFields', $detailFormFields);
     }
     return $detailFormFields;
 }
 /**
  * Returns a GridField of messages
  * @return CMSForm
  */
 public function getEditForm($id = null, $fields = null)
 {
     if (!$id) {
         $id = $this->currentPageID();
     }
     $form = parent::getEditForm($id);
     $record = $this->getRecord($id);
     if ($record && !$record->canView()) {
         return Security::permissionFailure($this);
     }
     // Build gridfield
     $messageListConfig = GridFieldConfig::create()->addComponents(new GridFieldSortableHeader(), new GridFieldDataColumns(), new GridFieldFooter());
     $messages = $this->Messages();
     if (is_string($messages)) {
         // The api returned an error
         $messagesList = new LiteralField("MessageAlert", '<div class="message bad">' . $messages . '</div>');
     } else {
         $messagesList = GridField::create('Messages', false, $messages, $messageListConfig)->addExtraClass("messages_grid");
         $columns = $messageListConfig->getComponentByType('GridFieldDataColumns');
         $columns->setDisplayFields(['transmission_id' => _t('SparkPostAdmin.EventTransmissionId', 'Id'), 'timestamp' => _t('SparkPostAdmin.EventDate', 'Date'), 'type' => _t('SparkPostAdmin.EventType', 'Type'), 'rcpt_to' => _t('SparkPostAdmin.EventRecipient', 'Recipient'), 'subject' => _t('SparkPostAdmin.EventSubject', 'Subject'), 'friendly_from' => _t('SparkPostAdmin.EventSender', 'Sender')]);
         $columns->setFieldFormatting(['timestamp' => function ($value, &$item) {
             return date('Y-m-d H:i:s', strtotime($value));
         }]);
         // Validator setup
         $validator = null;
         if ($record && method_exists($record, 'getValidator')) {
             $validator = $record->getValidator();
         }
         if ($validator) {
             $messageListConfig->getComponentByType('GridFieldDetailForm')->setValidator($validator);
         }
     }
     // Create tabs
     $messagesTab = new Tab('Messages', _t('SparkPostAdmin.Messages', 'Messages'), $messagesList, new HiddenField('ID', false, 0));
     $fields = new FieldList($root = new TabSet('Root', $messagesTab));
     if ($this->CanConfigureApi()) {
         $settingsTab = new Tab('Settings', _t('SparkPostAdmin.Settings', 'Settings'));
         $webhookTabData = $this->WebhookTab();
         $settingsTab->push($webhookTabData);
         $domainTabData = $this->DomainTab();
         $settingsTab->push($domainTabData);
         $fields->addFieldToTab('Root', $settingsTab);
     }
     // Tab nav in CMS is rendered through separate template
     $root->setTemplate('CMSTabSet');
     // Manage tabs state
     $actionParam = $this->getRequest()->param('Action');
     if ($actionParam == 'setting') {
         $settingsTab->addExtraClass('ui-state-active');
     } elseif ($actionParam == 'messages') {
         $messagesTab->addExtraClass('ui-state-active');
     }
     $actions = new FieldList();
     // Create cms form
     $form = CMSForm::create($this, 'EditForm', $fields, $actions)->setHTMLID('Form_EditForm');
     $form->setResponseNegotiator($this->getResponseNegotiator());
     $form->addExtraClass('cms-edit-form');
     $form->setTemplate($this->getTemplatesWithSuffix('_EditForm'));
     // Tab nav in CMS is rendered through separate template
     if ($form->Fields()->hasTabset()) {
         $form->Fields()->findOrMakeTab('Root')->setTemplate('CMSTabSet');
     }
     $form->addExtraClass('center ss-tabset cms-tabset ' . $this->BaseCSSClasses());
     $form->setAttribute('data-pjax-fragment', 'CurrentForm');
     $this->extend('updateEditForm', $form);
     return $form;
 }
 function getCMSFields()
 {
     if ($this->FolderID) {
         // New token - select file:
         $folder = DataObject::get_by_id('Folder', $this->FolderID);
         $files = new DataObjectSet();
         if ($folder->myChildren()) {
             foreach ($folder->myChildren() as $file) {
                 if (!$file instanceof Folder) {
                     $files->push($file);
                 }
             }
             $files->sort('Name');
         }
         $fileField = new DropdownField('FileID', 'File', $files->map('ID', 'Name'));
     } else {
         // Existing token:
         $fileField = new ReadonlyField('FileDummy', 'File', $this->File()->Name);
     }
     $fields = new FieldSet();
     $fields->push($root = new TabSet('Root'));
     $root->push($main = new Tab('Main'));
     $main->push($fileField);
     if (ClassInfo::exists('DatetimeField')) {
         // 2.4.x
         $main->push($expiry_field = new DatetimeField('Expiry', 'Expiry'));
         $expiry_field->getDateField()->setConfig('showcalendar', true);
         $expiry_field->getTimeField()->setConfig('showdropdown', true);
     } else {
         // 2.3.x
         $main->push($expiry_field = new PopupDateTimeField('Expiry', 'Expiry'));
     }
     $main->push(new ReadonlyField('MemberDummyField', 'Member', $this->MemberNice()));
     if ($this->ID) {
         $main->push(new ReadonlyField('Token', 'Token'));
     }
     $this->extend('updateCMSFields', $fields);
     return $fields;
 }
	public function getEditForm($id = null, $fields = null) {
		$form = parent::getEditForm($id, $fields);
		$folder = ($id && is_numeric($id)) ? DataObject::get_by_id('Folder', $id, false) : $this->currentPage();
		$fields = $form->Fields();

		$fields->push(new HiddenField('ID', false, $folder->ID));

		// File listing
		$gridFieldConfig = GridFieldConfig::create()->addComponents(
			new GridFieldSortableHeader(),
			new GridFieldDataColumns(),
			new GridFieldPaginator(15),
			new GridFieldEditButton(),
			new GridFieldDeleteAction(),
			new GridFieldDetailForm()
		);
		$gridField = new GridField('File','Files', $this->getList(), $gridFieldConfig);
		$columns = $gridField->getConfig()->getComponentByType('GridFieldDataColumns');
		$columns->setDisplayFields(array(
			'StripThumbnail' => '',
			// 'Parent.FileName' => 'Folder',
			'Title' => _t('File.Name'),
			'Created' => _t('AssetAdmin.CREATED', 'Date'),
			'Size' => _t('AssetAdmin.SIZE', 'Size'),
		));
		$columns->setFieldCasting(array(
			'Created' => 'Date->Nice'
		));
		$gridField->setAttribute(
			'data-url-folder-template', 
			Controller::join_links($this->Link('show'), '%s')
		);

		if($folder->canCreate()) {
			$uploadBtn = new LiteralField(
				'UploadButton', 
				sprintf(
					'<a class="ss-ui-button ss-ui-action-constructive cms-panel-link" data-target-panel=".cms-content" data-icon="drive-upload" href="%s">%s</a>',
					Controller::join_links(singleton('CMSFileAddController')->Link(), '?ID=' . $folder->ID),
					_t('Folder.UploadFilesButton', 'Upload')
				)
			);	
		} else {
			$uploadBtn = null;
		}

		if(!$folder->hasMethod('canAddChildren') || ($folder->hasMethod('canAddChildren') && $folder->canAddChildren())) {
			// TODO Will most likely be replaced by GridField logic
			$addFolderBtn = new LiteralField(
				'AddFolderButton', 
				sprintf(
					'<a class="ss-ui-button ss-ui-action-constructive cms-add-folder-link" data-icon="add" data-url="%s" href="%s">%s</a>',
					Controller::join_links($this->Link('AddForm'), '?' . http_build_query(array(
						'action_doAdd' => 1,
						'ParentID' => $folder->ID,
						'SecurityID' => $form->getSecurityToken()->getValue()
					))),
					Controller::join_links($this->Link('addfolder'), '?ParentID=' . $folder->ID),
					_t('Folder.AddFolderButton', 'Add folder')
				)
			);
		} else {
			$addFolderBtn = '';
		}

		if($folder->canEdit()) {
			$syncButton = new LiteralField(
				'SyncButton',
				sprintf(
					'<a class="ss-ui-button ss-ui-action ui-button-text-icon-primary ss-ui-button-ajax" title="%s" href="%s">%s</a>',
					_t('AssetAdmin.FILESYSTEMSYNCTITLE', 'Update the CMS database entries of files on the filesystem. Useful when new files have been uploaded outside of the CMS, e.g. through FTP.'),
					$this->Link('doSync'),
					_t('FILESYSTEMSYNC','Sync files')
				)
			);
		} else {
			$syncButton = null;
		}
		
		// Move existing fields to a "details" tab, unless they've already been tabbed out through extensions.
		// Required to keep Folder->getCMSFields() simple and reuseable,
		// without any dependencies into AssetAdmin (e.g. useful for "add folder" views).
		if(!$fields->hasTabset()) {
			$tabs = new TabSet('Root', 
				$tabList = new Tab('ListView', _t('AssetAdmin.ListView', 'List View')),
				$tabTree = new Tab('TreeView', _t('AssetAdmin.TreeView', 'Tree View'))
			);
			$tabList->addExtraClass("content-listview");
			$tabTree->addExtraClass("content-treeview");
			if($fields->Count() && $folder->exists()) {
				$tabs->push($tabDetails = new Tab('DetailsView', _t('AssetAdmin.DetailsView', 'Details')));
				$tabDetails->addExtraClass("content-galleryview");
				foreach($fields as $field) {
					$fields->removeByName($field->getName());
					$tabDetails->push($field);
				}
			}
			$fields->push($tabs);
		}

		// List view
		$fields->addFieldsToTab('Root.ListView', array(
			$actionsComposite = CompositeField::create(
				CompositeField::create(
					$uploadBtn,
					$addFolderBtn,
					$syncButton //TODO: add this into a batch actions menu as in https://github.com/silverstripe/silverstripe-design/raw/master/Design/ss3-ui_files-manager-list-view.jpg
				)->addExtraClass('cms-actions-row')
			)->addExtraClass('cms-content-toolbar field'),
			$gridField
		));
		
		$treeField = new LiteralField('Tree', '');
		// Tree view
		$fields->addFieldsToTab('Root.TreeView', array(
			clone $actionsComposite,
			// TODO Replace with lazy loading on client to avoid performance hit of rendering potentially unused views
			new LiteralField(
				'Tree',
				$treeField->createTag(
					'div', 
					array(
						'class' => 'cms-tree', 
						'data-url-tree' => $this->Link('getsubtree'), 
						'data-url-savetreenode' => $this->Link('savetreenode')
					),
					$this->SiteTreeAsUL()
				)
			)
		));

		$fields->setForm($form);
		$form->setTemplate($this->getTemplatesWithSuffix('_EditForm'));
		// TODO Can't merge $FormAttributes in template at the moment
		$form->addExtraClass('cms-edit-form cms-panel-padded center ' . $this->BaseCSSClasses());
		$form->Fields()->findOrMakeTab('Root')->setTemplate('CMSTabSet');

		$this->extend('updateEditForm', $form);

		return $form;
	}
 /**
  * Returns the slider tab input fields for this widget.
  * 
  * @param Widget $widget      Widget to initialize
  * @param TabSet &$rootTabSet The root tab set
  * 
  * @return void
  * 
  * @author Sebastian Diel <*****@*****.**>
  * @since 28.03.2012
  */
 public static function getCMSFieldsRoundaboutTabForProductSliderWidget(Widget $widget, &$rootTabSet)
 {
     $tab = new Tab('roundabout', $widget->fieldLabel('RoundaboutTab'));
     $useSlider = new CheckboxField('useRoundabout', $widget->fieldLabel('useRoundabout'));
     $tab->push($useSlider);
     $rootTabSet->push($tab);
 }
 /**
  * Provide content for the Preview tab
  * 
  * @return \Tab
  */
 protected function previewTab()
 {
     $tab = new Tab('Preview');
     // Preview iframe
     $previewLink = '/admin/emails/EmailTemplate/PreviewEmail/?id=' . $this->ID;
     $iframe = new LiteralField('iframe', '<iframe src="' . $previewLink . '" style="width:800px;background:#fff;min-height:500px;vertical-align:top"></iframe>');
     $tab->push($iframe);
     if (class_exists('CmsInlineFormAction')) {
         // Test emails
         $compo = new FieldGroup($recipient = new TextField('SendTestEmail', ''), $action = new CmsInlineFormAction('doSendTestEmail', 'Send'));
         $recipient->setAttribute('placeholder', '*****@*****.**');
         $recipient->setValue(Email::config()->admin_email);
         $tab->push(new HiddenField('EmailTemplateID', '', $this->ID));
         $tab->push(new HeaderField('SendTestEmailHeader', 'Send test email'));
         $tab->push($compo);
     }
     return $tab;
 }
 /**
  * Returns the input fields for this widget without scaffolding
  * 
  * @return FieldList
  * 
  * @author Sascha Koehler <*****@*****.**>, Sebastian Diel <*****@*****.**>
  * @since 03.09.2012
  */
 public function getCMSFields()
 {
     $fields = new FieldList();
     $rootTabSet = new TabSet('Root');
     $basicTab = new Tab('Basic', $this->fieldLabel('BasicTab'));
     $translationTab = new Tab('Translations', $this->fieldLabel('TranslationsTab'));
     $titleField = new TextField('FrontTitle', $this->fieldLabel('FrontTitle'));
     $contentField = new TextareaField('FrontContent', $this->fieldLabel('FrontContent'), 10);
     $imageTable = new GridField('SilvercartImages', $this->fieldLabel('Images'), $this->SilvercartImages()->sort('Sort'), SilvercartGridFieldConfig_RelationEditor::create());
     $imageTable->getConfig()->removeComponentsByType('GridFieldAddNewButton');
     $imageTable->getConfig()->removeComponentsByType('GridFieldAddExistingAutocompleter');
     $imageTable->getConfig()->addComponent(new GridFieldDeleteAction());
     $imageTable->getConfig()->addComponent(new GridFieldSortableRows('Sort'));
     $imagesUploadDescription = sprintf($this->fieldLabel('SilvercartImagesDescription'), $this->getSliderHeight());
     $imagesUploadField = new SilvercartImageUploadField('UploadSilvercartImages', $this->fieldLabel('AddImage'));
     $imagesUploadField->setFolderName('Uploads/silvercart-images');
     $imagesUploadField->setDescription($imagesUploadDescription);
     $translationsTableField = new GridField('SilvercartSlidorionProductGroupWidgetLanguages', $this->fieldLabel('translations'), $this->SilvercartSlidorionProductGroupWidgetLanguages(), SilvercartGridFieldConfig_ExclusiveRelationEditor::create());
     $widgetHeightField = new TextField('widgetHeight', $this->fieldLabel('widgetHeight'));
     $speedField = new TextField('speed', $this->fieldLabel('speed'));
     $intervalField = new TextField('interval', $this->fieldLabel('interval'));
     $effectField = new DropdownField('effect', $this->fieldLabel('effect'), singleton('SilvercartSlidorionProductGroupWidget')->dbObject('effect')->enumValues(), $this->effect);
     $hoverPauseField = new CheckboxField('hoverPause', $this->fieldLabel('hoverPause'));
     $autoPlayField = new CheckboxField('autoPlay', $this->fieldLabel('autoPlay'));
     $advancedToggle = ToggleCompositeField::create('AdvancedToggle', $this->fieldLabel('AdvancedTab'), array($widgetHeightField, $speedField, $intervalField, $effectField, $hoverPauseField, $autoPlayField))->setHeadingLevel(4);
     $basicTab->push($titleField);
     $basicTab->push($contentField);
     $basicTab->push($imagesUploadField);
     $basicTab->push($imageTable);
     $basicTab->push($advancedToggle);
     $translationTab->push($translationsTableField);
     $fields->push($rootTabSet);
     $rootTabSet->push($basicTab);
     $rootTabSet->push($translationTab);
     return $fields;
 }