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


PHP JFormFieldText::setup方法代码示例

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


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

示例1: testSetupMaxlength

 /**
  * Tests maxLength attribute setup by JFormFieldText::setup method
  *
  * @covers JFormField::setup
  * @covers JFormField::__get
  *
  * @return void
  */
 public function testSetupMaxlength()
 {
     $field = new JFormFieldText();
     $element = simplexml_load_string('<field name="myName" type="text" maxlength="60" />');
     $this->assertThat($field->setup($element, ''), $this->isTrue(), 'Line:' . __LINE__ . ' The setup method should return true if successful.');
     $this->assertThat($field->maxLength, $this->equalTo(60), 'Line:' . __LINE__ . ' The property should be computed from the XML.');
 }
开发者ID:shoffmann52,项目名称:install-from-web-server,代码行数:15,代码来源:JFormFieldTextTest.php

示例2: testGetInput

	/**
	 * Test the getInput method.
	 *
	 * @return void
	 */
	public function testGetInput()
	{
		$form = new JFormInspector('form1');

		$this->assertThat(
			$form->load('<form><field name="text" type="text" /></form>'),
			$this->isTrue(),
			'Line:' . __LINE__ . ' XML string should load successfully.'
		);

		$field = new JFormFieldText($form);

		$this->assertThat(
			$field->setup($form->getXml()->field, 'value'),
			$this->isTrue(),
			'Line:' . __LINE__ . ' The setup method should return true.'
		);

		$this->assertThat(
			strlen($field->input),
			$this->greaterThan(0),
			'Line:' . __LINE__ . ' The getInput method should return something without error.'
		);

		// TODO: Should check all the attributes have come in properly.
	}
开发者ID:realityking,项目名称:joomla-platform,代码行数:31,代码来源:JFormFieldTextTest.php

示例3: setup

 public function setup(SimpleXMLElement $element, $value, $group = null)
 {
     $this->element = $element;
     $element['label'] = $this->prepareText($element['label']);
     $element['description'] = $this->prepareText($element['description']);
     $element['translateDescription'] = false;
     return parent::setup($element, $value, $group);
 }
开发者ID:lyrasoft,项目名称:lyrasoft.github.io,代码行数:8,代码来源:text.php

示例4: setup

 /**
  * Method to attach a JForm object to the field.
  *
  * @param   SimpleXMLElement  $element  The SimpleXMLElement object representing the <field /> tag for the form field object.
  * @param   mixed             $value    The form field value to validate.
  * @param   string            $group    The field name group control value. This acts as as an array container for the field.
  *                                      For example if the field has name="foo" and the group value is set to "bar" then the
  *                                      full field name would end up being "bar[foo]".
  *
  * @return  boolean  True on success.
  *
  * @see     JFormField::setup()
  * @since   3.2
  */
 public function setup(SimpleXMLElement $element, $value, $group = null)
 {
     $result = parent::setup($element, $value, $group);
     if ($result == true) {
         $this->format = (string) $this->element['format'] ? (string) $this->element['format'] : 'Y-m-d';
     }
     return $result;
 }
开发者ID:smhnaji,项目名称:sdnet,代码行数:22,代码来源:created.php

示例5: setup

 public function setup(&$element, $value, $group = null)
 {
     $return = parent::setup($element, $value, $group);
     $this->element['class'] = $this->element['class'] . ' color';
     if ($this->element['name'] != 'title_color' and $this->element['name'] != 'date_color') {
         $this->element['onchange'] = 'document.getElementById(\'jform_params_calendar_style\').value=\'custom\'';
     }
     return $return;
 }
开发者ID:ankaau,项目名称:GathBandhan,代码行数:9,代码来源:color.php

示例6: setup

 /**
  * Method to attach a JForm object to the field.
  *
  * @param   SimpleXMLElement  $element  The SimpleXMLElement object representing the <field /> tag for the form field object.
  * @param   mixed             $value    The form field value to validate.
  * @param   string            $group    The field name group control value. This acts as as an array container for the field.
  *                                      For example if the field has name="foo" and the group value is set to "bar" then the
  *                                      full field name would end up being "bar[foo]".
  *
  * @return  boolean  True on success.
  *
  * @see     JFormField::setup()
  * @since   3.2
  */
 public function setup(SimpleXMLElement $element, $value, $group = null)
 {
     $return = parent::setup($element, $value, $group);
     if ($return) {
         $this->countertext = isset($this->element['countertext']) ? (string) $this->element['countertext'] : '';
         $this->countertext = JText::_($this->countertext);
         $this->maxlength = isset($this->element['maxlength']) ? (int) $this->element['maxlength'] : 0;
         $this->class .= ' charcounter';
     }
     return $return;
 }
开发者ID:techjoomla,项目名称:techjoomla-lib,代码行数:25,代码来源:textcounter.php

示例7: setup

 public function setup(SimpleXMLElement $element, $value, $group = null)
 {
     $rt = parent::setup($element, $value, $group);
     $label = (string) $this->element['label'];
     if (empty($label)) {
         $option = JFactory::getApplication()->input->getCmd('option');
         $prefix = $option;
         if ($option == 'com_plugins') {
             $prefix = $this->form->getData()->get('name');
         }
         $label = strtoupper($prefix . '_' . $this->fieldname);
     }
     $this->element['label'] = $label;
     $this->element['description'] = $label . '_DESC';
     $this->description = $label . '_DESC';
     return $rt;
 }
开发者ID:apiceweb,项目名称:MageBridgeCore,代码行数:17,代码来源:text.php

示例8: setup

 /**
  * Method to attach a JForm object to the field.
  *
  * @param   SimpleXMLElement  $element  The SimpleXMLElement object representing the <field /> tag for the form field object.
  * @param   mixed             $value    The form field value to validate.
  * @param   string            $group    The field name group control value. This acts as as an array container for the field.
  *                                      For example if the field has name="foo" and the group value is set to "bar" then the
  *                                      full field name would end up being "bar[foo]".
  *
  * @return  boolean  True on success.
  *
  * @see     JFormField::setup()
  * @since   3.2
  */
 public function setup(SimpleXMLElement $element, $value, $group = null)
 {
     $result = parent::setup($element, $value, $group);
     if ($result == true) {
         // Get the client id.
         $clientId = $this->element['client_id'];
         if (!isset($clientId)) {
             $clientName = $this->element['client'];
             if (isset($clientName)) {
                 $client = JApplicationHelper::getClientInfo($clientName, true);
                 $clientId = $client->id;
             }
         }
         if (!isset($clientId) && $this->form instanceof JForm) {
             $clientId = $this->form->getValue('client_id');
         }
         $this->clientId = (int) $clientId;
     }
     return $result;
 }
开发者ID:klas,项目名称:joomla-cms,代码行数:34,代码来源:moduleposition.php

示例9: testSetup

 /**
  * Tests the name, value, id, title, lalbel property setup by JFormField::setup method
  *
  * @param   array   $expected  @todo
  * @param   string  $element   @todo
  * @param   string  $value     @todo
  * @param   string  $group     @todo
  *
  * @return void
  *
  * @dataProvider  getSetupData
  */
 public function testSetup($expected, $element, $value, $group = null)
 {
     $field = new JFormFieldText();
     $element = simplexml_load_string($element);
     $this->assertThat($field->setup($element, $value, $group), $this->isTrue(), 'Line:' . __LINE__ . ' The setup method should return true if successful.');
     // Matcher for the 'label' attribute
     $matcher = array('id' => 'myId-lbl', 'tag' => 'label', 'attributes' => array('for' => 'myId', 'class' => 'hasTooltip', 'title' => '<strong>My Title</strong><br />The description.'), 'content' => 'regexp:/My Title/');
     foreach ($expected as $attr => $value) {
         // Label is html use assertTag()
         if ($attr == 'label') {
             $this->assertTag($matcher, $field->{$attr}, 'Line:' . __LINE__ . ' The ' . $attr . ' property should be computed from the XML.');
         } else {
             $this->assertThat($field->{$attr}, $this->equalTo($value), 'Line:' . __LINE__ . ' The ' . $attr . ' property should be computed from the XML.');
         }
     }
 }
开发者ID:klas,项目名称:joomla-cms,代码行数:28,代码来源:JFormFieldTest.php

示例10: setup

 public function setup(SimpleXMLElement $element, $value, $group = null)
 {
     $return = parent::setup($element, $value, $group);
     $this->element['class'] = $this->element['class'] . ' color';
     return $return;
 }
开发者ID:naquib555,项目名称:quBitolgy,代码行数:6,代码来源:color.php

示例11: testSetup

 /**
  * Tests the name, value, id, title, lalbel property setup by JFormField::setup method
  *
  * @param   array   $expected  @todo
  * @param   string  $element   @todo
  * @param   string  $value     @todo
  * @param   string  $group     @todo
  *
  * @return void
  *
  * @dataProvider  getSetupData
  */
 public function testSetup($expected, $element, $value, $group = null)
 {
     $field = new JFormFieldText();
     $element = simplexml_load_string($element);
     $this->assertThat($field->setup($element, $value, $group), $this->isTrue(), 'Line:' . __LINE__ . ' The setup method should return true if successful.');
     foreach ($expected as $attr => $value) {
         $this->assertThat($field->{$attr}, $this->equalTo($value), 'Line:' . __LINE__ . ' The ' . $attr . ' property should be computed from the XML.');
     }
 }
开发者ID:shoffmann52,项目名称:install-from-web-server,代码行数:21,代码来源:JFormFieldTest.php


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