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


PHP FormField::getName方法代码示例

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


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

示例1: addFormField

 /**
  * Add a FormField
  *
  * @param FormField $formField FormField object to add
  */
 public function addFormField(FormField $formField)
 {
     if (isset($this->fields[$formField->getName()])) {
         throw new SWException(sprintf("Field already exists.\n\tForm: %s\n\tField name: ", $this->name, $formField->getName()));
     }
     $this->fields[$formField->getName()] = $formField;
 }
开发者ID:carriercomm,项目名称:NeoBill,代码行数:12,代码来源:Form.class.php

示例2: addPart

 /**
  * @return FormField
  */
 public function addPart(FormField $part)
 {
     if (strval($part->getName()) === '') {
         $part->setName(sprintf('%s-%s', $this->getName(), count($this->parts)));
     }
     $part->setAttribute('data-part', count($this->parts));
     $this->parts[] = $part;
     return $this;
 }
开发者ID:helpfulrobot,项目名称:nblum-silverstripe-customizableinputfield,代码行数:12,代码来源:CustomizableInputFieldSet.php

示例3: transformFormField

 /**
  * Transform a given form field into a composite field, where the translation is editable and the original value
  * is added as a read-only field.
  * @param FormField $field
  * @return CompositeField
  */
 public function transformFormField(FormField $field)
 {
     $newfield = $field->performReadOnlyTransformation();
     $fieldname = $field->getName();
     if ($this->original->isLocalizedField($fieldname)) {
         $field->setName($this->original->getLocalizedFieldName($fieldname));
         $field->setValue($this->original->getLocalizedValue($fieldname));
     }
     return $this->baseTransform($newfield, $field, $fieldname);
 }
开发者ID:bummzack,项目名称:translatable-dataobject,代码行数:16,代码来源:TranslatableFormFieldTransformation.php

示例4:

 /**
  * Create a new nullable field
  * @param $valueField
  * @return NullableField
  */
 function __construct(FormField $valueField, $isNullLabel = null)
 {
     $this->valueField = $valueField;
     $this->isNullLabel = $isNullLabel;
     if (is_null($this->isNullLabel)) {
         // Set a default label if one is not provided.
         $this->isNullLabel = _t('NullableField.IsNullLabel', 'Is Null');
     }
     parent::__construct($valueField->getName(), $valueField->Title(), $valueField->Value(), $valueField->getForm(), $valueField->RightTitle());
     $this->readonly = $valueField->isReadonly();
 }
开发者ID:prostart,项目名称:cobblestonepath,代码行数:16,代码来源:NullableField.php

示例5: getJavascript

    protected function getJavascript()
    {
        return '
		EcomBuyableSelectField.set_nothingFound("' . _t('BuyableSelectField.NOTHINGFOUND', 'no products found - please try again') . '");
		EcomBuyableSelectField.set_fieldName("' . Convert::raw2js($this->getName()) . '");
		EcomBuyableSelectField.set_formName("' . Convert::raw2js($this->form->FormName()) . '");
		EcomBuyableSelectField.set_countOfSuggestions(' . $this->countOfSuggestions . ');
		EcomBuyableSelectField.set_selectedBuyableFieldName("' . Convert::raw2js($this->fieldSelectedBuyable->getName()) . '");
		EcomBuyableSelectField.set_selectedBuyableFieldID("' . Convert::raw2js($this->fieldSelectedBuyable->id()) . '");
		';
    }
开发者ID:helpfulrobot,项目名称:sunnysideup-ecommerce,代码行数:11,代码来源:BuyableSelectField.php

示例6: __construct

 /**
  * Create a new nullable field
  *
  * @param FormField $valueField
  * @param null|string $isNullLabel
  */
 public function __construct(FormField $valueField, $isNullLabel = null)
 {
     $this->valueField = $valueField;
     if (isset($isNullLabel)) {
         $this->setIsNullLabel($isNullLabel);
     } else {
         $this->isNullLabel = _t('NullableField.IsNullLabel', 'Is Null');
     }
     parent::__construct($valueField->getName(), $valueField->Title(), $valueField->Value());
     $this->setForm($valueField->getForm());
     $this->setRightTitle($valueField->RightTitle());
     $this->setReadonly($valueField->isReadonly());
 }
开发者ID:ntd,项目名称:sapphire,代码行数:19,代码来源:NullableField.php

示例7: applyParsley

 /**
  * Sets the html attributes required for frontend validation
  * Subclasses should call parent::applyParsley
  * @return void
  * */
 public function applyParsley()
 {
     if (!$this->field) {
         user_error("A constrained Field does not exist on the FieldSet, check you have the right field name for your ZenValidatorConstraint.", E_USER_ERROR);
     }
     $this->parsleyApplied = true;
     if ($this->customMessage) {
         $this->field->setAttribute(sprintf('data-parsley-%s-message', $this->getConstraintName()), $this->customMessage);
     }
     // CheckboxSetField might not have a unique name, so set parsley-multiple attribute
     if (get_class($this->field) === 'CheckboxSetField') {
         $this->field->setAttribute('data-parsley-multiple', $this->field->getName());
     }
 }
开发者ID:helpfulrobot,项目名称:sheadawson-silverstripe-zenvalidator,代码行数:19,代码来源:ZenValidatorConstraint.php

示例8: transform

 public function transform(FormField $field)
 {
     if (!$field instanceof GridField) {
         throw new Exception(__CLASS__ . ' requires GridField FormField type.');
     }
     $title = $field->Title();
     $list = $field->getList();
     $config = $field->getConfig();
     $result = MultiRecordField::create($field->getName(), $title, $list);
     // Support: GridFieldExtensions (https://github.com/silverstripe-australia/silverstripe-gridfieldextensions)
     $gridFieldAddNewMultiClass = $config->getComponentsByType('GridFieldAddNewMultiClass')->first();
     if ($gridFieldAddNewMultiClass) {
         $classes = $gridFieldAddNewMultiClass->getClasses($field);
         $result->setModelClasses($classes);
     }
     return $result;
 }
开发者ID:silbinarywolf,项目名称:multirecordfield,代码行数:17,代码来源:MultiRecordTransformation.php

示例9: __construct

 /**
  * @param FormField $child
  */
 public function __construct($child)
 {
     parent::__construct($child->getName());
     $this->child = $child;
     $this->checkbox = new CheckboxField("Visible[{$this->name}]", '');
 }
开发者ID:helpfulrobot,项目名称:ajshort-silverstripe-memberprofiles,代码行数:9,代码来源:CheckableVisibilityField.php

示例10: getNestedFieldName

 /**
  * Returns the actual name of a child field without the prefix of this 
  * field.
  *
  * @param FormField $field
  *
  * @return string
  */
 protected function getNestedFieldName($field)
 {
     return substr($field->getName(), strlen($this->getName()) + 1, -1);
 }
开发者ID:fullscreeninteractive,项目名称:silverstripe-addressfinder,代码行数:12,代码来源:AddressFinderField.php

示例11: 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

示例12: customFieldConstraints

 public function customFieldConstraints(\FormField $field, array $allFieldConstraints)
 {
     if ($field->getName() == static::RelationshipName) {
         $this->configureUploadField($field);
     }
 }
开发者ID:CrackerjackDigital,项目名称:silverstripe-modular,代码行数:6,代码来源:HasFiles.php

示例13: getFormat

 public function getFormat()
 {
     $fields = AddressFormat::getOrderedAddressFields($this->country->id, true, true);
     $required = array_flip(AddressFormat::getFieldsRequired());
     $format = ['id_address' => (new FormField())->setName('id_address')->setType('hidden'), 'id_customer' => (new FormField())->setName('id_customer')->setType('hidden'), 'back' => (new FormField())->setName('back')->setType('hidden'), 'token' => (new FormField())->setName('token')->setType('hidden'), 'alias' => (new FormField())->setName('alias')->setLabel($this->getFieldLabel('alias'))];
     foreach ($fields as $field) {
         $formField = new FormField();
         $formField->setName($field);
         $fieldParts = explode(':', $field, 2);
         if (count($fieldParts) === 1) {
             if ($field === 'postcode') {
                 if ($this->country->need_zip_code) {
                     $formField->setRequired(true);
                 }
             }
         } elseif (count($fieldParts) === 2) {
             list($entity, $entityField) = $fieldParts;
             // Fields specified using the Entity:field
             // notation are actually references to other
             // entities, so they should be displayed as a select
             $formField->setType('select');
             // Also, what we really want is the id of the linked entity
             $formField->setName('id_' . strtolower($entity));
             if ($entity === 'Country') {
                 $formField->setType('countrySelect');
                 $formField->setValue($this->country->id);
                 foreach ($this->availableCountries as $country) {
                     $formField->addAvailableValue($country['id_country'], $country[$entityField]);
                 }
             } elseif ($entity === 'State') {
                 if ($this->country->contains_states) {
                     $states = State::getStatesByIdCountry($this->country->id);
                     foreach ($states as $state) {
                         $formField->addAvailableValue($state['id_state'], $state[$entityField]);
                     }
                     $formField->setRequired(true);
                 }
             }
         }
         $formField->setLabel($this->getFieldLabel($field));
         if (!$formField->isRequired()) {
             // Only trust the $required array for fields
             // that are not marked as required.
             // $required doesn't have all the info, and fields
             // may be required for other reasons than what
             // AddressFormat::getFieldsRequired() says.
             $formField->setRequired(array_key_exists($field, $required));
         }
         $format[$formField->getName()] = $formField;
     }
     return $this->addConstraints($this->addMaxLength($format));
 }
开发者ID:M03G,项目名称:PrestaShop,代码行数:52,代码来源:CustomerAddressFormatter.php

示例14: isFieldModified

 /**
  * Given a field on an object and optionally a locale, compare its locale value against the default locale value to
  * determine if the value is changed at the given locale.
  *
  * @param  DataObject  $object
  * @param  FormField   $field
  * @param  string|null $locale Optional: if not provided, will be gathered from the request
  * @return boolean
  */
 public static function isFieldModified(DataObject $object, FormField $field, $locale = null)
 {
     if (is_null($locale)) {
         $locale = self::current_locale();
     }
     if ($locale === ($defaultLocale = self::default_locale())) {
         // It's the default locale, so it's never "modified" from the default locale value
         return false;
     }
     $defaultField = self::db_field_for_locale($field->getName(), $defaultLocale);
     $localeField = self::db_field_for_locale($field->getName(), $locale);
     $defaultValue = $object->{$defaultField};
     $localeValue = $object->{$localeField};
     if (!empty($defaultValue) && empty($localeValue) || $defaultValue === $localeValue) {
         // Unchanged from default
         return false;
     }
     return true;
 }
开发者ID:tractorcow,项目名称:silverstripe-fluent,代码行数:28,代码来源:Fluent.php

示例15: testGetSchemaData

 public function testGetSchemaData()
 {
     $field = new FormField('MyField');
     $schema = $field->getSchemaData();
     $this->assertEquals('MyField', $schema['name']);
     // Make sure the schema data is up-to-date with object properties.
     $field->setName('UpdatedField');
     $schema = $field->getSchemaData();
     $this->assertEquals($field->getName(), $schema['name']);
 }
开发者ID:jacobbuck,项目名称:silverstripe-framework,代码行数:10,代码来源:FormFieldTest.php


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