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


PHP JForm::getLabel方法代码示例

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


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

示例1: testGetInput

 /**
  * Test the getInput method.
  *
  * @return void
  */
 public function testGetInput()
 {
     $form = new JForm('form1');
     // Test a traditional hidden field type.
     $this->assertThat($form->load('<form><field name="hidden" type="hidden" label="foo" /></form>'), $this->isTrue(), 'Line:' . __LINE__ . ' XML string should load successfully.');
     $this->assertEmpty($form->getLabel('hidden'), 'Line:' . __LINE__ . ' The label of a hidden element should be nothing.');
     // Test a field with attribute hidden = true.
     $this->assertThat($form->load('<form><field name="hidden" type="text" label="foo" hidden="true" /></form>'), $this->isTrue(), 'Line:' . __LINE__ . ' XML string should load successfully.');
     $this->assertEmpty($form->getLabel('hidden'), 'Line:' . __LINE__ . ' The label of a hidden element should be nothing.');
     // Test a field with attribute hidden = false.
     $this->assertThat($form->load('<form><field name="hidden" type="text" label="foo" hidden="false" /></form>'), $this->isTrue(), 'Line:' . __LINE__ . ' XML string should load successfully.');
     $matcher = array('id' => 'hidden-lbl', 'tag' => 'label', 'attributes' => array('for' => 'hidden', 'class' => ''), 'content' => 'regexp:/foo/');
     $this->assertTag($matcher, $form->getLabel('hidden'), 'Line:' . __LINE__ . ' The label of a non-hidden element should be some HTML.');
 }
开发者ID:akirsoft,项目名称:joomla-cms,代码行数:19,代码来源:JFormFieldHiddenTest.php

示例2: testGetInput

 /**
  * Test the getInput method.
  *
  * @return void
  */
 public function testGetInput()
 {
     $form = new JForm('form1');
     // Test a traditional hidden field type.
     $this->assertThat($form->load('<form><field name="hidden" type="hidden" label="foo" /></form>'), $this->isTrue(), 'Line:' . __LINE__ . ' XML string should load successfully.');
     $field = new JFormFieldHidden($form);
     $this->assertThat($form->getLabel('hidden'), $this->equalTo(''), 'Line:' . __LINE__ . ' The label of a hidden element should be nothing.');
     // Test a field with attribute hidden = true.
     $this->assertThat($form->load('<form><field name="hidden" type="text" label="foo" hidden="true" /></form>'), $this->isTrue(), 'Line:' . __LINE__ . ' XML string should load successfully.');
     $field = new JFormFieldHidden($form);
     $this->assertThat($form->getLabel('hidden'), $this->equalTo(''), 'Line:' . __LINE__ . ' The label of a hidden element should be nothing.');
     // Test a field with attribute hidden = false.
     $this->assertThat($form->load('<form><field name="hidden" type="text" label="foo" hidden="false" /></form>'), $this->isTrue(), 'Line:' . __LINE__ . ' XML string should load successfully.');
     $field = new JFormFieldHidden($form);
     $this->assertThat($form->getLabel('hidden'), $this->equalTo('<label id="hidden-lbl" for="hidden" class="">foo</label>'), 'Line:' . __LINE__ . ' The label of a non-hidden element should be some HTML.');
 }
开发者ID:shoffmann52,项目名称:install-from-web-server,代码行数:21,代码来源:JFormFieldHiddenTest.php

示例3: getInput

 protected function getInput()
 {
     $end = $this->element['end'];
     $styles = $this->element['styles'];
     $background = $this->element['background'] ? 'background-image: url(' . $this->getPathToImages() . '/images/' . $this->element['background'] . ');' : '';
     $tag = $this->element['tag'];
     if ($end == '1') {
         // $html = '</li></'.$tag.'><li>';
         $html = '</' . $tag . '><div><div>';
     } else {
         // $html = '</li><'.$tag.' style="'.$background.$styles.'" ><li>';
         $html = '</div></div><' . $tag . ' style="' . $background . $styles . '" >';
     }
     // var_dump($html);
     $identifier = 'menustyles';
     $form = new JForm($identifier);
     JForm::addFormPath(JPATH_SITE . '/modules/mod_slideshowck/elements/test');
     if (!($formexists = $form->loadFile($identifier, false))) {
         echo '<p style="color:red">' . JText::_('Problem loading the file : ' . $identifier . '.xml') . '</p>';
         return '';
     }
     $fields = $form->getFieldset();
     foreach ($fields as $key => $field) {
         // echo '<div class="ckpopup_row">';
         $html .= $form->getLabel(str_replace($identifier . "_", "", $key), $identifier);
         $html .= $form->getInput(str_replace($identifier . "_", "", $key), $identifier);
         // echo '</div>';
     }
     return $html;
 }
开发者ID:esorone,项目名称:efcpw,代码行数:30,代码来源:ckcontainer.php


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