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


PHP CompositeField::setName方法代码示例

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


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

示例1: createTwoColumnField

    public function createTwoColumnField($id, $label, $field1, $field2)
    {
        $twoColumnField = new CompositeField(new LiteralField($id . '-wrap', '
<div id="' . $id . '-wrap" class="field fieldgroup">
    <label class="left" for="HeaderLogoOffsetLarge">' . $label . '</label>
    <div class="middleColumn">
        <div id="' . $id . '[X]" class="fieldgroup-field nolabel" style="padding-top: 0; margin-top: -7px;">
            <div class="nolabel">
                '), $field1, new LiteralField('MobileLogoOffSetField2', '
  </div>
        </div>
        <div id="' . $id . '[Y]" class="fieldgroup-field nolabel" style="padding-top: 0; margin-top: -7px;">
            <div class="nolabel">
                '), $field2, new LiteralField('MobileLogoOffSetField3', '
   </div>
        </div>
    </div>
</div>
'));
        $twoColumnField->addExtraClass('field');
        $twoColumnField->setName($id);
        return $twoColumnField;
    }
开发者ID:guru-digital,项目名称:gdm-ss-express,代码行数:23,代码来源:SSGDMExpressSiteConfig.php

示例2: duplicateOrReplaceFields

 protected function duplicateOrReplaceFields(&$fields)
 {
     $tasks = array('dup' => array());
     foreach ($fields as $field) {
         if ($field->isComposite()) {
             $innertasks = $this->duplicateOrReplaceFields($field->FieldSet());
             $tasks['dup'] = array_merge($tasks['dup'], $innertasks['dup']);
         } else {
             if (($fieldname = $field->Name()) && array_key_exists($fieldname, $this->original_values)) {
                 // Get a copy of the original field to show the untranslated value
                 if (is_subclass_of($field->class, 'TextareaField')) {
                     $nonEditableField = new ToggleField($fieldname, $field->Title(), '', '+', '-');
                     $nonEditableField->labelMore = '+';
                     $nonEditableField->labelLess = '-';
                 } else {
                     $nonEditableField = $field->performDisabledTransformation();
                 }
                 $nonEditableField_holder = new CompositeField($nonEditableField);
                 $nonEditableField_holder->setName($fieldname . '_holder');
                 $nonEditableField_holder->addExtraClass('originallang_holder');
                 $nonEditableField->setValue($this->original_values[$fieldname]);
                 $nonEditableField->setName($fieldname . '_original');
                 $nonEditableField->addExtraClass('originallang');
                 if (array_search($fieldname, $this->translatableFields) !== false) {
                     // Duplicate the field
                     if ($field->Title()) {
                         $nonEditableField->setTitle('Original');
                     }
                     $nonEditableField_holder->insertBeforeRecursive($field, $fieldname . '_original');
                     $tasks['dup'][$fieldname] = $nonEditableField_holder;
                 }
             }
         }
     }
     return $tasks;
 }
开发者ID:ramziammar,项目名称:websites,代码行数:36,代码来源:Translatable.php

示例3: LinkForm

 /**
  * Return a {@link Form} instance allowing a user to
  * add links in the TinyMCE content editor.
  *
  * @return Form
  */
 public function LinkForm()
 {
     $siteTree = TreeDropdownField::create('internal', _t('HTMLEditorField.PAGE', "Page"), 'SilverStripe\\CMS\\Model\\SiteTree', 'ID', 'MenuTitle', true);
     // mimic the SiteTree::getMenuTitle(), which is bypassed when the search is performed
     $siteTree->setSearchFunction(array($this, 'siteTreeSearchCallback'));
     $numericLabelTmpl = '<span class="step-label"><span class="flyout">%d</span><span class="arrow"></span>' . '<strong class="title">%s</strong></span>';
     $form = new Form($this->controller, "{$this->name}/LinkForm", new FieldList($headerWrap = new CompositeField(new LiteralField('Heading', sprintf('<h3 class="htmleditorfield-mediaform-heading insert">%s</h3>', _t('HTMLEditorField.LINK', 'Insert Link')))), $contentComposite = new CompositeField(OptionsetField::create('LinkType', DBField::create_field('HTMLFragment', sprintf($numericLabelTmpl, '1', _t('HTMLEditorField.LINKTO', 'Link to'))), array('internal' => _t('HTMLEditorField.LINKINTERNAL', 'Page on the site'), 'external' => _t('HTMLEditorField.LINKEXTERNAL', 'Another website'), 'anchor' => _t('HTMLEditorField.LINKANCHOR', 'Anchor on this page'), 'email' => _t('HTMLEditorField.LINKEMAIL', 'Email address'), 'file' => _t('HTMLEditorField.LINKFILE', 'Download a file')), 'internal'), LiteralField::create('Step2', '<div class="step2">' . sprintf($numericLabelTmpl, '2', _t('HTMLEditorField.DETAILS', 'Details')) . '</div>'), $siteTree, TextField::create('external', _t('HTMLEditorField.URL', 'URL'), 'http://'), EmailField::create('email', _t('HTMLEditorField.EMAIL', 'Email address')), $fileField = UploadField::create('file', _t('HTMLEditorField.FILE', 'File')), TextField::create('Anchor', _t('HTMLEditorField.ANCHORVALUE', 'Anchor')), TextField::create('Subject', _t('HTMLEditorField.SUBJECT', 'Email subject')), TextField::create('Description', _t('HTMLEditorField.LINKDESCR', 'Link description')), CheckboxField::create('TargetBlank', _t('HTMLEditorField.LINKOPENNEWWIN', 'Open link in a new window?')), HiddenField::create('Locale', null, $this->controller->Locale))), new FieldList());
     $headerWrap->setName('HeaderWrap');
     $headerWrap->addExtraClass('CompositeField composite cms-content-header form-group--no-label ');
     $contentComposite->setName('ContentBody');
     $contentComposite->addExtraClass('ss-insert-link content');
     $fileField->setAllowedMaxFileNumber(1);
     $form->unsetValidator();
     $form->loadDataFrom($this);
     $form->addExtraClass('htmleditorfield-form htmleditorfield-linkform cms-mediaform-content');
     $this->extend('updateLinkForm', $form);
     return $form;
 }
开发者ID:jacobbuck,项目名称:silverstripe-framework,代码行数:24,代码来源:HTMLEditorField.php

示例4: baseTransform

 protected function baseTransform($nonEditableField, $originalField)
 {
     $fieldname = $originalField->Name();
     $nonEditableField_holder = new CompositeField($nonEditableField);
     $nonEditableField_holder->setName($fieldname . '_holder');
     $nonEditableField_holder->addExtraClass('originallang_holder');
     $nonEditableField->setValue($this->original->{$fieldname});
     $nonEditableField->setName($fieldname . '_original');
     $nonEditableField->addExtraClass('originallang');
     $nonEditableField->setTitle('Original ' . $originalField->Title());
     $nonEditableField_holder->insertBefore($originalField, $fieldname . '_original');
     return $nonEditableField_holder;
 }
开发者ID:eLBirador,项目名称:AllAboutCity,代码行数:13,代码来源:Translatable.php

示例5: baseTransform

 /**
  * Transform a translatable field to show the field value from the default language
  * DataObject below the translated field.
  * 
  * This is a fallback function which handles field types that aren't transformed by
  * $this->transform{FieldType} functions.
  * 
  * @param FormField $nonEditableField The readonly field to contain the original value
  * @param FormField $originalField The original editable field containing the translated value
  * @return \CompositeField The transformed field
  */
 protected function baseTransform($nonEditableField, $originalField)
 {
     $fieldname = $originalField->getName();
     $nonEditableField_holder = new CompositeField($nonEditableField);
     $nonEditableField_holder->setName($fieldname . '_holder');
     $nonEditableField_holder->addExtraClass('originallang_holder');
     $nonEditableField->setValue($this->original->{$fieldname});
     $nonEditableField->setName($fieldname . '_original');
     $nonEditableField->addExtraClass('originallang');
     $nonEditableField->setTitle(_t('Translatable_Transform.OriginalFieldLabel', 'Original {title}', 'Label for the original value of the translatable field.', array('title' => $originalField->Title())));
     $nonEditableField_holder->insertBefore($originalField, $fieldname . '_original');
     return $nonEditableField_holder;
 }
开发者ID:camfindlay,项目名称:silverstripe-translatable,代码行数:24,代码来源:Translatable.php


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