当前位置: 首页>>代码示例>>PHP>>正文


PHP SiteTree::enableCMSFieldsExtensions方法代码示例

本文整理汇总了PHP中SiteTree::enableCMSFieldsExtensions方法的典型用法代码示例。如果您正苦于以下问题:PHP SiteTree::enableCMSFieldsExtensions方法的具体用法?PHP SiteTree::enableCMSFieldsExtensions怎么用?PHP SiteTree::enableCMSFieldsExtensions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SiteTree的用法示例。


在下文中一共展示了SiteTree::enableCMSFieldsExtensions方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getCMSFields

 function getCMSFields()
 {
     $blogOwners = $this->blogOwners();
     SiteTree::disableCMSFieldsExtensions();
     $fields = parent::getCMSFields();
     SiteTree::enableCMSFieldsExtensions();
     $fields->addFieldToTab('Root.Content.Main', new CheckboxField('TrackBacksEnabled', 'Enable TrackBacks'));
     $fields->addFieldToTab('Root.Content.Main', new DropdownField('OwnerID', 'Blog owner', $blogOwners->toDropDownMap('ID', 'Name', 'None')));
     $fields->addFieldToTab('Root.Content.Main', new CheckboxField('AllowCustomAuthors', 'Allow non-admins to have a custom author field'));
     $this->extend('updateCMSFields', $fields);
     return $fields;
 }
开发者ID:nicmart,项目名称:comperio-site,代码行数:12,代码来源:BlogHolder.php

示例2: getCMSFields

 function getCMSFields()
 {
     Requirements::javascript('blog/javascript/bbcodehelp.js');
     Requirements::themedCSS('bbcodehelp');
     $firstName = Member::currentUser() ? Member::currentUser()->FirstName : '';
     $codeparser = new BBCodeParser();
     SiteTree::disableCMSFieldsExtensions();
     $fields = parent::getCMSFields();
     SiteTree::enableCMSFieldsExtensions();
     if (!self::$allow_wysiwyg_editing) {
         $fields->removeFieldFromTab("Root.Content.Main", "Content");
         $fields->addFieldToTab("Root.Content.Main", new TextareaField("Content", _t("BlogEntry.CN", "Content"), 20));
     }
     $fields->addFieldToTab("Root.Content.Main", $dateField = new DatetimeField("Date", _t("BlogEntry.DT", "Date")), "Content");
     $dateField->getDateField()->setConfig('showcalendar', true);
     $dateField->getTimeField()->setConfig('showdropdown', true);
     $fields->addFieldToTab("Root.Content.Main", new TextField("Author", _t("BlogEntry.AU", "Author"), $firstName), "Content");
     if (!self::$allow_wysiwyg_editing) {
         $fields->addFieldToTab("Root.Content.Main", new LiteralField("BBCodeHelper", "<div id='BBCode' class='field'>" . "<a  id=\"BBCodeHint\" target='new'>" . _t("BlogEntry.BBH", "BBCode help") . "</a>" . "<div id='BBTagsHolder' style='display:none;'>" . $codeparser->useable_tagsHTML() . "</div></div>"));
     }
     $fields->addFieldToTab("Root.Content.Main", new TextField("Tags", _t("BlogEntry.TS", "Tags (comma sep.)")), "Content");
     $this->extend('updateCMSFields', $fields);
     return $fields;
 }
开发者ID:nicmart,项目名称:comperio-site,代码行数:24,代码来源:BlogEntry.php

示例3: getCMSFields

    /**
     * @return FieldList
     */
    public function getCMSFields()
    {
        // call updateCMSFields after userforms
        SiteTree::disableCMSFieldsExtensions();
        $fields = parent::getCMSFields();
        SiteTree::enableCMSFieldsExtensions();
        // define tabs
        $fields->findOrMakeTab('Root.FormContent', _t('UserDefinedForm.FORM', 'Form'));
        $fields->findOrMakeTab('Root.FormOptions', _t('UserDefinedForm.CONFIGURATION', 'Configuration'));
        $fields->findOrMakeTab('Root.Submissions', _t('UserDefinedForm.SUBMISSIONS', 'Submissions'));
        // field editor
        $fields->addFieldToTab("Root.FormContent", new FieldEditor("Fields", 'Fields', "", $this));
        // text to show on complete
        $onCompleteFieldSet = new CompositeField($label = new LabelField('OnCompleteMessageLabel', _t('UserDefinedForm.ONCOMPLETELABEL', 'Show on completion')), $editor = new HtmlEditorField("OnCompleteMessage", "", _t('UserDefinedForm.ONCOMPLETEMESSAGE', $this->OnCompleteMessage)));
        $onCompleteFieldSet->addExtraClass('field');
        $editor->setRows(3);
        $label->addExtraClass('left');
        // Set the summary fields of UserDefinedForm_EmailRecipient dynamically via config system
        Config::inst()->update('UserDefinedForm_EmailRecipient', 'summary_fields', array('EmailAddress' => _t('UserDefinedForm.EMAILADDRESS', 'Email'), 'EmailSubject' => _t('UserDefinedForm.EMAILSUBJECT', 'Subject'), 'EmailFrom' => _t('UserDefinedForm.EMAILFROM', 'From')));
        // who do we email on submission
        $emailRecipients = new GridField("EmailRecipients", _t('UserDefinedForm.EMAILRECIPIENTS', 'Email Recipients'), $this->EmailRecipients(), GridFieldConfig_RecordEditor::create(10));
        $emailRecipients->getConfig()->getComponentByType('GridFieldAddNewButton')->setButtonName(_t('UserDefinedForm.ADDEMAILRECIPIENT', 'Add Email Recipient'));
        $fields->addFieldsToTab("Root.FormOptions", $onCompleteFieldSet);
        $fields->addFieldToTab("Root.FormOptions", $emailRecipients);
        $fields->addFieldsToTab("Root.FormOptions", $this->getFormOptions());
        // view the submissions
        $submissions = new GridField("Reports", _t('UserDefinedForm.SUBMISSIONS', 'Submissions'), $this->Submissions()->sort('Created', 'DESC'));
        // make sure a numeric not a empty string is checked against this int column for SQL server
        $parentID = !empty($this->ID) ? $this->ID : 0;
        // get a list of all field names and values used for print and export CSV views of the GridField below.
        $columnSQL = <<<SQL
SELECT "Name", "Title"
FROM "SubmittedFormField"
LEFT JOIN "SubmittedForm" ON "SubmittedForm"."ID" = "SubmittedFormField"."ParentID"
WHERE "SubmittedForm"."ParentID" = '{$parentID}'
ORDER BY "Title" ASC
SQL;
        $columns = DB::query($columnSQL)->map();
        $config = new GridFieldConfig();
        $config->addComponent(new GridFieldToolbarHeader());
        $config->addComponent($sort = new GridFieldSortableHeader());
        $config->addComponent($filter = new UserFormsGridFieldFilterHeader());
        $config->addComponent(new GridFieldDataColumns());
        $config->addComponent(new GridFieldEditButton());
        $config->addComponent(new GridState_Component());
        $config->addComponent(new GridFieldDeleteAction());
        $config->addComponent(new GridFieldPageCount('toolbar-header-right'));
        $config->addComponent($pagination = new GridFieldPaginator(25));
        $config->addComponent(new GridFieldDetailForm());
        $config->addComponent($export = new GridFieldExportButton());
        $config->addComponent($print = new GridFieldPrintButton());
        $sort->setThrowExceptionOnBadDataType(false);
        $filter->setThrowExceptionOnBadDataType(false);
        $pagination->setThrowExceptionOnBadDataType(false);
        // attach every column to the print view form
        $columns['Created'] = 'Created';
        $filter->setColumns($columns);
        // print configuration
        $print->setPrintHasHeader(true);
        $print->setPrintColumns($columns);
        // export configuration
        $export->setCsvHasHeader(true);
        $export->setExportColumns($columns);
        $submissions->setConfig($config);
        $fields->addFieldToTab("Root.Submissions", $submissions);
        $fields->addFieldToTab("Root.FormOptions", new CheckboxField('DisableSaveSubmissions', _t('UserDefinedForm.SAVESUBMISSIONS', "Disable Saving Submissions to Server")));
        $this->extend('updateCMSFields', $fields);
        return $fields;
    }
开发者ID:prostart,项目名称:erics-homes,代码行数:72,代码来源:UserDefinedForm.php


注:本文中的SiteTree::enableCMSFieldsExtensions方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。