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


PHP Field::getName方法代码示例

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


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

示例1: addField

 /**
  * @param Field $field
  * @throws DuplicateFieldException
  */
 public function addField(Field $field)
 {
     if (isset($this->fields[$field->getName()])) {
         throw new DuplicateFieldException('Field `' . $field->getName() . '` already exists');
     }
     $this->fields[$field->getName()] = $field;
 }
开发者ID:mammothmkiv,项目名称:php-validator,代码行数:11,代码来源:FieldList.php

示例2: removeField

 public function removeField(Field $field)
 {
     if (isset($this->fields[$field->getName()])) {
         unset($this->fields[$field->getName()]);
     }
     return $this;
 }
开发者ID:pavelkolomitkin,项目名称:nigma-blog,代码行数:7,代码来源:Form.php

示例3: renderNonSelectField

 /**
  * Renders a non select field.
  *
  * @return string (X)HTML.
  */
 protected function renderNonSelectField()
 {
     $o = '';
     if (function_exists('advfrm_custom_field_default')) {
         $val = advfrm_custom_field_default($this->form, $this->field->getName(), null, isset($_POST['advfrm']));
     }
     if (!isset($val)) {
         $val = isset($_POST[$this->name]) ? stsl($_POST[$this->name]) : $this->field->getDefaultValue();
     }
     if ($this->field->getType() == 'textarea') {
         $cols = $this->field->getColumnCount() ? $this->field->getColumnCount() : 40;
         $rows = $this->field->getRowCount() ? $this->field->getRowCount() : 4;
         $o .= '<textarea id="' . $this->id . '" name="' . $this->name . '" cols="' . $cols . '" rows="' . $rows . '">' . XH_hsc($val) . '</textarea>';
     } elseif ($this->field->getType() == 'output') {
         $o .= $val;
     } else {
         if ($this->field->getType() == 'date') {
             $this->initDatePicker();
         }
         $size = $this->field->getType() == 'hidden' || $this->field->getSize() ? ' size="' . $this->field->getSize() . '"' : '';
         $maxlen = in_array($this->field->getType(), array('hidden', 'file')) || !$this->field->getMaxLength() ? '' : ' maxlength="' . $this->field->getMaxLength() . '"';
         if ($this->field->getType() == 'file' && $this->field->getMaxLength()) {
             $o .= tag('input type="hidden" name="MAX_FILE_SIZE" value="' . $this->field->getMaxLength() . '"');
         }
         if ($this->field->getType() == 'file') {
             $value = '';
             $accept = ' accept="' . XH_hsc($this->prefixFileExtensionList($val)) . '"';
         } else {
             $value = ' value="' . XH_hsc($val) . '"';
             $accept = '';
         }
         $o .= tag('input type="' . $this->getInputElementType() . '" id="' . $this->id . '" name="' . $this->name . '"' . $value . $accept . $size . $maxlen);
     }
     return $o;
 }
开发者ID:bbfriend,项目名称:advancedform_xh,代码行数:40,代码来源:FieldView.php

示例4: addField

 /**
  * Add field
  * 
  * @param  Field $field
  * @throws \LogicException
  */
 public function addField(Field $field)
 {
     $name = $field->getName();
     if (isset($this->fields[$name])) {
         throw new \LogicException(sprintf('Field "%s" already exists', $name));
     }
     $this->fields[$name] = $field;
 }
开发者ID:mikemirten,项目名称:ConstructorCMS,代码行数:14,代码来源:Schema.php

示例5: validateFilledInFieldCustom

 /**
  * Validates a filled in field wrt. custom constraints.
  *
  * @return string (X)HTML.
  */
 protected function validateFilledInFieldCustom()
 {
     $o = '';
     if (function_exists('advfrm_custom_valid_field')) {
         $value = $this->field->getType() == 'file' ? $_FILES[$this->name] : stsl($_POST[$this->name]);
         $valid = advfrm_custom_valid_field($this->formId, $this->field->getName(), $value);
         if ($valid !== true) {
             $o .= '<li>' . $valid . '</li>' . PHP_EOL;
             Controller::focusField($this->formId, $this->name);
         }
     }
     return $o;
 }
开发者ID:bbfriend,项目名称:advancedform_xh,代码行数:18,代码来源:FieldValidator.php

示例6: renderField

 /**
  * Renders a field.
  *
  * @param Field $field A field.
  *
  * @return string
  */
 protected function renderField(Field $field)
 {
     $name = 'advfrm-' . $field->getName();
     $o = $field->getLabel() . PHP_EOL;
     if (isset($_POST[$name])) {
         if (is_array($_POST[$name])) {
             foreach ($_POST[$name] as $val) {
                 $o .= '  ' . stsl($val) . PHP_EOL;
             }
         } else {
             $o .= '  ' . $this->indent(stsl($_POST[$name])) . PHP_EOL;
         }
     } elseif (isset($_FILES[$name])) {
         $o .= '  ' . stsl($_FILES[$name]['name']) . PHP_EOL;
     }
     return $o;
 }
开发者ID:bbfriend,项目名称:advancedform_xh,代码行数:24,代码来源:PlainTextMailView.php

示例7: renderField

 /**
  * Renders a field.
  *
  * @param Field $field A field.
  *
  * @return string (X)HTML
  */
 protected function renderField(Field $field)
 {
     $name = 'advfrm-' . $field->getName();
     $o = '<tr><td class="label">' . XH_hsc($field->getLabel()) . '</td><td class="field">';
     if (isset($_POST[$name])) {
         if (is_array($_POST[$name])) {
             foreach ($_POST[$name] as $val) {
                 $o .= '<div>' . XH_hsc(stsl($val)) . '</div>';
             }
         } else {
             $o .= $this->nl2br(XH_hsc(stsl($_POST[$name])));
         }
     } elseif (isset($_FILES[$name])) {
         $o .= stsl($_FILES[$name]['name']);
     }
     $o .= '</td></tr>' . PHP_EOL;
     return $o;
 }
开发者ID:bbfriend,项目名称:advancedform_xh,代码行数:25,代码来源:HTMLMailView.php

示例8: testField

 public function testField()
 {
     $f = new Field('test', 1);
     $this->assertEquals('test', $f->getName());
     $this->assertEquals(1, $f->getTable());
     $f = new AllFields();
     $this->assertEquals(0, $f->getTable());
     $f = new AllFields(2);
     $this->assertEquals(2, $f->getTable());
     try {
         $f = new Field(array('1'));
         $this->fail('first parameter should be string (array is not allowed)');
     } catch (InvalidArgumentException $e) {
     }
     try {
         $f = new Field('foo', 'bar');
         $this->fail('second parameter has to be numeric');
     } catch (InvalidArgumentException $e) {
     }
 }
开发者ID:NinjaKC,项目名称:MySQL-Query-Builder,代码行数:20,代码来源:OtherTest.php

示例9: hasField

 /**
  * Returns TRUE whether the given field is contained in the fields collection
  *
  * @param Field $field
  *
  * @return boolean
  */
 public function hasField(Field $field)
 {
     return array_key_exists($field->getName(), $this->fields);
 }
开发者ID:mremi,项目名称:dolist,代码行数:11,代码来源:Contact.php

示例10: add

 public function add(Field $field)
 {
     $name = $field->getName();
     $this->fields[$name] = $field;
 }
开发者ID:sidroberts,项目名称:forms,代码行数:5,代码来源:Form.php

示例11: removeField

 /**
  * Remove data field.
  *
  * @param Field $field Data field.
  */
 public function removeField(Field $field)
 {
     if (isset($this->fields[$field->getName()])) {
         unset($this->fields[$field->getName()]);
         $this->length--;
     }
 }
开发者ID:energine-cmf,项目名称:energine,代码行数:12,代码来源:Data.php

示例12: addField

 public function addField(Field $field)
 {
     $this->fields[$field->getName()] = $field;
     return $this;
 }
开发者ID:laasti,项目名称:form,代码行数:5,代码来源:Group.php

示例13: attachField

 /**
  * Adds field to model
  * @param string $fieldName
  * @param Field $field
  */
 protected function attachField($field, $toBeginning = false)
 {
     if ($this->isFrozen()) {
         throw new Exception("Unable to attach field '" . $field->getName() . "' to frozen model.");
     }
     if (key_exists($field->getName(), $this->fields)) {
         throw new Exception("Field with name '" . $field->getName() . "' already exists in model '" . get_class($this) . "'");
     }
     if ($toBeginning) {
         $this->fields = array($field->getName() => $field) + $this->fields;
     } else {
         $this->fields[$field->getName()] = $field;
     }
     //$this->fields[$field->getName()]->setModel($this);
     return $this->fields[$field->getName()];
 }
开发者ID:Edke,项目名称:PerfORM,代码行数:21,代码来源:PerfORM.php

示例14: getAttributes

 public function getAttributes(Field $field)
 {
     return $this->getConfigurationFor($field->getDocument())->findAttributes($field->getName());
 }
开发者ID:tomaszhanc,项目名称:form-field-bundle,代码行数:4,代码来源:Definition.php

示例15: addField

 public function addField($name, $message = '')
 {
     $field = new Field($name, $message);
     $this->fields[$field->getName()] = $field;
 }
开发者ID:willthibodeau,项目名称:elitemeatsutah,代码行数:5,代码来源:fields.php


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