本文整理汇总了PHP中Block::getCMSFields方法的典型用法代码示例。如果您正苦于以下问题:PHP Block::getCMSFields方法的具体用法?PHP Block::getCMSFields怎么用?PHP Block::getCMSFields使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Block
的用法示例。
在下文中一共展示了Block::getCMSFields方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getCMSFields
/**
* Get CMS fields
*
* @return FieldList
*/
public function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->removeByName('TeamMembers');
$fields->addFieldToTab('Root.Main', GridField::create('TeamMembers', 'Team Members', $this->TeamMembers(), GridFieldConfig_RecordEditor::create()->addComponent(new GridFieldSortableRows('SortOrder'))));
return $fields;
}
示例2: getCMSFields
/**
* Get Cms fields
*
* @return FieldList
*/
public function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->removeByName('ActionBoxes');
$fields->removeFieldsFromTab('Root.Main', array('Content'));
$fields->addFieldToTab('Root.Main', GridField::create('ActionBoxes', 'Action Boxes', $this->ActionBoxes(), GridFieldConfig_RecordEditor::create()->addComponent(new GridFieldSortableRows('SortOrder'))));
return $fields;
}
示例3: getCMSFields
public function getCMSFields()
{
$fields = parent::getCMSFields();
$tinyMce = HtmlEditorField::create('Content', _t('TextBlock.CONTENT', 'Content'));
$fields->addFieldToTab('Root.Main', $tinyMce);
$this->extend('updateCMSFields', $fields);
return $fields;
}
示例4: getCMSFields
/**
* Get CMS fields
*
* @return FieldList
*/
public function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->removeFieldsFromTab('Root.Main', array('BackgroundImage', 'Items'));
$fields->removeByName('SpinningBanners');
$fields->addFieldToTab('Root.Main', GridField::create('SpinningBanners', 'Spinning Banners', $this->SpinningBanners(), GridFieldConfig_RecordEditor::create()->addComponent(new GridFieldSortableRows('SortOrder'))));
return $fields;
}
示例5: getCMSFields
public function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->addFieldsToTab("Root.Employee", new TextField('Name', 'Name'));
$fields->addFieldsToTab("Root.Employee", new TextField('Phone', 'Phone'));
$fields->addFieldsToTab("Root.Employee", new TextField('Email', 'Email'));
return $fields;
}
示例6: getCMSFields
/**
* Get CMS Fields
*
* @return FieldList
*/
public function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->insertAfter($fields->dataFieldByName('ButtonText'), 'Content');
$fields->insertAfter($fields->dataFieldByName('RedirectPageID'), 'ButtonText');
$fields->dataFieldByName('Content')->setRows(20);
$fields->replaceField('RedirectPageID', TreedropdownField::create('RedirectPageID', 'Choose a redirect page', 'SiteTree'));
return $fields;
}
示例7: getCMSFields
public function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->removeFieldFromTab('Root', 'Links');
$fields->addFieldToTab('Root.Main', HeaderField::create('LinksHeader', 'Quick Links'));
if ($this->ID) {
$fields->addFieldToTab('Root.Main', GridField::create('Links', 'Links', $this->getItems(), GridFieldConfig_RelationEditor::create()->addComponent(new GridFieldOrderableRows())->removeComponentsByType('GridFieldAddExistingAutocompleter')->addComponent(new GridFieldAddExistingSearchButton())));
}
return $fields;
}
示例8: getCMSFields
public function getCMSFields()
{
$fields = parent::getCMSFields();
$uploadField = null;
if (class_exists('SortableUploadField')) {
$uploadField = SortableUploadField::create('Images', _t('ImageBlock.IMAGES', 'Images'));
} else {
$uploadField = UploadField::create('Images', _t('ImageBlock.IMAGES', 'Images'));
}
$fields->addFieldToTab('Root.Main', $uploadField);
$this->extend('updateCMSFields', $fields);
return $fields;
}
示例9: getCMSFields
/**
* Get CMS Fields
*
* @return FieldList
*/
public function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->dataFieldByName('Content')->setRows(20);
$fields->replaceField('RedirectPageID', TreeDropdownField::create('RedirectPageID', 'Choose a redirect page', 'SiteTree'));
$fields->dataFieldByName('Image')->setTitle('Featured Image')->setFolderName('BlockWidgetImage/' . $this->ID . '/Images');
$fields->insertAfter($fields->dataFieldByName('Position')->setTitle('Image position'), 'Title');
$fields->insertAfter($fields->dataFieldByName('Content'), 'Position');
$fields->insertAfter($fields->dataFieldByName('Image'), 'Content');
$fields->insertBefore($fields->dataFieldByName('ButtonText'), 'Image');
$fields->insertBefore($fields->dataFieldByName('RedirectPageID'), 'Image');
return $fields;
}
示例10: getCMSFields
public function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->removeFieldFromTab('Root', 'Items');
if ($this->ID) {
$config = GridFieldConfig_RecordEditor::create()->addComponent(new GridFieldOrderableRows());
$grid = GridField::create('Items', 'Items', $this->Items()->filter('ParentID', 0), $config);
$config->getComponentByType('GridFieldDataColumns')->setDisplayFields(array('Title' => 'Menu Item Title', 'Children.Count' => 'Num Children'));
$fields->addFieldToTab('Root.Main', HeaderField::create('ItemsHeader', 'Menu Items'));
$fields->addFieldToTab('Root.Main', $grid);
}
return $fields;
}
示例11: getCMSFields
public function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->removeByName(array('PageID', 'SortOrder', 'Active', 'Title', 'Content', 'Blocks', 'YoutubeVideoID', 'Images', 'Media', 'Files', 'Videos'));
if ($this->ID) {
$BlockConfig = GridFieldConfig_RelationEditor::create(20);
$BlockConfig->addComponent(new GridFieldOrderableRows('SortOrder'));
$BlockGF = new GridField('Blocks', 'Blocks', $this->Blocks(), $BlockConfig);
$classes = array_values(ClassInfo::subclassesFor($BlockGF->getModelClass()));
if (count($classes) > 1 && class_exists('GridFieldAddNewMultiClass')) {
$BlockConfig->removeComponentsByType('GridFieldAddNewButton');
$BlockConfig->addComponent(new GridFieldAddNewMultiClass());
}
$fields->addFieldToTab("Root.Main", $BlockGF);
}
return $fields;
}
示例12: getCMSFields
public function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->removeByName('ExcludeItems');
$fields->removeByName('SourceID');
$pageClasses = SiteTree::page_type_classes();
$pageTypes = array();
foreach ($pageClasses as $class) {
$pageTypes[$class] = singleton($class)->i18n_singular_name();
}
$fields->addFieldsToTab('Root.Main', array(CheckboxField::create('EnforceShowInMenu', _t('ChildPageListBlock.EXCLUDEITEMSNOTINMENUS', "Exclude items which don't show in menus")), MultiValueListField::create('PageTypes', _t('ChildPageListBock.ONLYINCLUDETYPES', 'Only include these page types'), $pageTypes)->setRightTitle('Leave blank to include all types'), OptionsetField::create('AbsoluteSource', _t('ChildPageListBock.SOURCEOPTION', 'Source option'), array(false => _t('ChildPageListBock.SOURCECURRENTPAGE', 'Current page being viewed'), true => _t('ChildPageListBock.SOURCESPECIFICPAGE', 'A specific page'))), TreeDropdownField::create('SourceID', _t('ChildPageListBock.SOURCEPAGE', 'Source page'), 'SiteTree')->displayIf("AbsoluteSource")->isEqualTo(1)->end()));
if ($this->AbsoluteSource) {
$kids = $this->Source()->AllChildren();
if ($kids && $kids->Count()) {
$fields->addFieldToTab('Root.Main', MultiValueListField::create('ExcludeItems', _t('ChildPageListBock.EXCLUDECHILDREN', 'Exclude these children'), $kids->map('ID', 'Title'))->displayIf("AbsoluteSource")->isEqualTo(1)->end());
}
}
return $fields;
}
示例13: getCMSFields
public function getCMSFields()
{
$fields = parent::getCMSFields();
// field to enter the video URL
$externalField = TextField::create('ExternalMedia', _t('VideoBlock.VIDEO_URL', 'Video URL'));
// field for video aspect-ratio
$ratios = Config::inst()->get('VideoBlock', 'aspect_ratios');
$ratioField = null;
if (is_array($ratios)) {
$values = array();
foreach ($ratios as $ratio) {
if (preg_match('{(\\d+)/(\\d+)}', $ratio, $matches)) {
$float = number_format(intval($matches[2]) / intval($matches[1]), 6);
$values[$float] = $matches[0];
} else {
if ($ratio == '0') {
$values['0'] = 'Automatic';
}
}
}
if (count($values) > 0) {
$ratioField = DropdownField::create('ManualRatio', _t('VideoBlock.ASPECT_RATIO', 'Aspect ratio'), $values);
}
}
// preview thumbnail if media is set
if ($this->MediaThumbID) {
$thumb = $this->MediaThumb()->SetWidth(120);
$fields->addFieldToTab('Root.Main', LiteralField::create('MediaThumb', '<div class="field"><div class="middleColumn">' . $thumb->Tag . '</div></div>'));
}
$fields->addFieldToTab('Root.Main', $externalField);
if ($ratioField) {
$fields->addFieldToTab('Root.Main', $ratioField);
}
$this->extend('updateCMSFields', $fields);
return $fields;
}
示例14: getCMSFields
/**
* Get CMS Fields
*
* @return FieldList
*/
public function getCMSFields()
{
$fields = parent::getCMSFields();
return $fields;
}
示例15: getCMSFields
/**
* Get CMS fields
*
* @return FieldList
*/
public function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->insertAfter($fields->dataFieldByName('Image')->setFolderName('Banners'), 'Content');
return $fields;
}