/**
  * 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.');
 }
 /**
  * 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.');
 }
Beispiel #3
0
 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;
 }