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


PHP LiteralField::setTitle方法代码示例

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


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

示例1: getCMSFields

    public function getCMSFields()
    {
        Requirements::javascript('slider/javascript/slideredit.js');
        $fields = parent::getCMSFields();
        $existing_photo = null;
        $photo_field = null;
        $internal_page = $this->InternalPage();
        if ($internal_page instanceof RenderableAsPortlet) {
            error_log('Class implements renderable as a portlet');
            $existing_photo = $this->InternalPage()->getPortletImage();
        } else {
            // check parents recursively
            $parents = class_parents($internal_page);
            error_log(print_r($parents, 1));
        }
        $fields->addFieldToTab('Root.Main', new TreeDropdownField('InternalPageID', _t('SlidePage.CHOOSE_INTERNAL_LINK', 'Select a page on the website to link to'), 'SiteTree'));
        $composite_photoField = null;
        if (!$existing_photo) {
            $photo_field = new UploadField('Photo', _t('SlidePage.PHOTO', 'Photo'));
            $photo_info = new LiteralField('PhotoInfo', _t('Slide.PHOTO_INFO', 'If the page you choose to link to has an image already it will appear here'), 'Photo');
            $composite_photoField = CompositeField::create($photo_field, $photo_info);
        } else {
            // FIXME, find a cleaner way of doing this
            $composite_photoField = new LiteralField('Thumbnail2', '<div id="Thumbnail2" class="field readonly">
    <label class="left" for="Form_EditForm_Thumbnail2">Photo</label>
    <div class="middleColumn">
    <span id="Form_EditForm_Thumbnail2" class="readonly">
        <img src="' . $existing_photo->SetWidth(400)->URL . '" alt="' . $existing_photo->Title . '" />
    </span>
    </div>
</div>');
        }
        $composite_photoField->setTitle('Photo');
        $fields->addFieldToTab('Root.Main', $composite_photoField);
        $fields->addFieldToTab('Root.Main', new TextField('Caption', _t('SlidePage.CAPTION', 'Caption')));
        $fields->renameField('Title', 'Slide Title');
        $fields->removeFieldFromTab('Root.Main', 'Content');
        return $fields;
    }
开发者ID:gordonbanderson,项目名称:Slider,代码行数:39,代码来源:SlidePage.php


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