render() публичный Метод

Renders a button.
public render ( array $data, Cake\View\Form\ContextInterface $context ) : string
$data array The data to build a button with.
$context Cake\View\Form\ContextInterface The current form context.
Результат string
Пример #1
0
 /**
  * Ensure templateVars option is hooked up.
  *
  * @return void
  */
 public function testRenderTemplateVars()
 {
     $this->templates->add(['button' => '<button {{attrs}} custom="{{custom}}">{{text}}</button>']);
     $button = new ButtonWidget($this->templates);
     $data = ['templateVars' => ['custom' => 'value'], 'text' => 'Go'];
     $result = $button->render($data, $this->context);
     $expected = ['button' => ['type' => 'submit', 'custom' => 'value', 'class' => 'btn btn-default'], 'Go', '/button'];
     $this->assertHtml($expected, $result);
 }