label() public method

append the label
Since: 3.0.0
public label ( string $html = null, array $attributeArray = [] ) : Form
$html string html of the label
$attributeArray array attributes of the label
return Form
Example #1
0
 /**
  * render the view
  *
  * @since 3.0.0
  *
  * @return string
  */
 public function render()
 {
     $output = Hook::trigger('consoleFormStart');
     /* html elements */
     $formElement = new Html\Form($this->_registry, $this->_language);
     $formElement->init(['form' => ['class' => 'rs-console-js-form rs-console-form-default']]);
     $myUser = $this->_registry->get('myUser');
     $outputLabel = $myUser ? $myUser . '@' : null;
     $outputLabel .= $this->_registry->get('host') . ':~$';
     /* create the form */
     $formElement->label($outputLabel, ['class' => 'rs-console-js-label rs-console-label-default', 'for' => 'prompt'])->text(['autocapitalize' => 'off', 'autofocus' => 'autofocus', 'autocomplete' => 'off', 'class' => 'rs-console-js-field rs-console-field-text', 'id' => 'prompt', 'name' => 'argv', 'spellcheck' => 'false']);
     /* collect output */
     $output .= $formElement;
     $output .= Hook::trigger('consoleFormEnd');
     return $output;
 }
 /**
  * testLabel
  *
  * @param string $text
  * @param array $attributeArray
  * @param array $expect
  *
  * @dataProvider providerLabel
  *
  * @since 2.6.0
  */
 public function testLabel($text = null, $attributeArray = array(), $expect = array())
 {
     /* setup */
     $form = new Html\Form($this->_registry, $this->_language);
     $form->init();
     $form->label($text, $attributeArray);
     /* actual */
     $actual = $form;
     /* compare */
     $this->assertEquals($expect, $actual);
 }