Redaxscript\Html\Form::legend PHP Method

legend() public method

append the legend
Since: 3.0.0
public legend ( string $html = null, array $attributeArray = [] ) : Form
$html string html of the legend
$attributeArray array attributes of the legend
return Form
    public function legend($html = null, $attributeArray = [])
    {
        if (is_array($attributeArray)) {
            $attributeArray = array_merge($this->_attributeArray['legend'], $attributeArray);
        } else {
            $attributeArray = $this->_attributeArray['legend'];
        }
        $legendElement = new Element();
        $legendElement->init('legend', $attributeArray)->html($html ? $html : $this->_language->get($this->_languageArray['legend']) . $this->_language->get('point'));
        $this->append($legendElement);
        return $this;
    }

Usage Example

 /**
  * testLegend
  *
  * @param string $text
  * @param array $attributeArray
  * @param array $expect
  *
  * @dataProvider providerLegend
  *
  * @since 2.6.0
  */
 public function testLegend($text = null, $attributeArray = array(), $expect = array())
 {
     /* setup */
     $form = new Html\Form($this->_registry, $this->_language);
     $form->init();
     $form->legend($text, $attributeArray);
     /* actual */
     $actual = $form;
     /* compare */
     $this->assertEquals($expect, $actual);
 }