/** * Add a new widget to FormHelper. * * Allows you to add or replace widget instances with custom code. * * @param string $name The name of the widget. e.g. 'text'. * @param array|\Cake\View\Widget\WidgetInterface $spec Either a string class * name or an object implementing the WidgetInterface. * @return void */ public function addWidget($name, $spec) { $this->_registry->add([$name => $spec]); }
/** * Test getting resolve dependency missing dependency * * @expectedException \RuntimeException * @expectedExceptionMessage Unknown widget "label" * @return void */ public function testGetResolveDependencyMissingDependency() { $inputs = new WidgetRegistry($this->templates, $this->view); $inputs->clear(); $inputs->add(['multicheckbox' => ['Cake\\View\\Widget\\MultiCheckboxWidget', 'label']]); $inputs->get('multicheckbox'); }