예제 #1
0
 /**
  * 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]);
 }
예제 #2
0
 /**
  * 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');
 }