當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。