コード例 #1
0
ファイル: description.php プロジェクト: Bakual/BibleLinkXT
 /**
  * Method to get the field label markup for a spacer.
  * Use the label text or name from the XML element as the spacer or
  * Use a hr="true" to automatically generate plain hr markup
  *
  * @return  string  The field label markup.
  *
  * @since   1.0
  */
 protected function getLabel()
 {
     $html = parent::getLabel();
     // Run content plugins.
     $html = JHtml::_('content.prepare', $html);
     return $html;
 }
コード例 #2
0
 /**
  * Test the getLabel method.
  */
 public function testGetLabel()
 {
     $form = new JFormInspector('form1');
     $this->assertThat($form->load('<form><field name="spacer" type="spacer" description="spacer" /></form>'), $this->isTrue(), 'Line:' . __LINE__ . ' XML string should load successfully.');
     $field = new JFormFieldSpacer($form);
     $this->assertThat($field->setup($form->getXml()->field, 'value'), $this->isTrue(), 'Line:' . __LINE__ . ' The setup method should return true.');
     $this->assertEquals($field->label, '<span class="spacer"><span class="before"></span><span class=""><label id="spacer-lbl" class="hasTip" title="spacer::spacer">spacer</label></span><span class="after"></span></span>', 'Line:' . __LINE__ . ' The getLabel method should return something without error.');
     $this->assertThat($form->load('<form><field name="spacer" type="spacer" class="text" /></form>'), $this->isTrue(), 'Line:' . __LINE__ . ' XML string should load successfully.');
     $field = new JFormFieldSpacer($form);
     $this->assertThat($field->setup($form->getXml()->field, 'value'), $this->isTrue(), 'Line:' . __LINE__ . ' The setup method should return true.');
     $this->assertEquals($field->label, '<span class="spacer"><span class="before"></span><span class="text"><label id="spacer-lbl" class="">spacer</label></span><span class="after"></span></span>', 'Line:' . __LINE__ . ' The getLabel method should return something without error.');
     $this->assertThat($form->load('<form><field name="spacer" type="spacer" class="text" label="MyLabel" /></form>'), $this->isTrue(), 'Line:' . __LINE__ . ' XML string should load successfully.');
     $field = new JFormFieldSpacer($form);
     $this->assertThat($field->setup($form->getXml()->field, 'value'), $this->isTrue(), 'Line:' . __LINE__ . ' The setup method should return true.');
     $this->assertEquals($field->label, '<span class="spacer"><span class="before"></span><span class="text"><label id="spacer-lbl" class="">MyLabel</label></span><span class="after"></span></span>', 'Line:' . __LINE__ . ' The getLabel method should return something without error.');
     $this->assertThat($form->load('<form><field name="spacer" type="spacer" hr="true" /></form>'), $this->isTrue(), 'Line:' . __LINE__ . ' XML string should load successfully.');
     $field = new JFormFieldSpacer($form);
     $this->assertThat($field->setup($form->getXml()->field, 'value'), $this->isTrue(), 'Line:' . __LINE__ . ' The setup method should return true.');
     $this->assertEquals($field->label, '<span class="spacer"><span class="before"></span><span class=""><hr class="" /></span><span class="after"></span></span>', 'Line:' . __LINE__ . ' The getLabel method should return something without error.');
 }
コード例 #3
0
 /**
  * Method to get certain otherwise inaccessible properties from the form field object.
  *
  * @param   string  $name  The property name for which to the the value.
  *
  * @return  mixed  The property value or null.
  *
  * @since   2.0
  */
 public function __get($name)
 {
     switch ($name) {
         case 'static':
             if (empty($this->static)) {
                 $this->static = $this->getStatic();
             }
             return $this->static;
             break;
         case 'repeatable':
             if (empty($this->repeatable)) {
                 $this->repeatable = $this->getRepeatable();
             }
             return $this->static;
             break;
         default:
             return parent::__get($name);
     }
 }