Skip to content
Permalink
Browse files

Add an accessor for the input registry.

  • Loading branch information...
markstory committed Feb 12, 2014
1 parent 874c6c5 commit 178c286bcb06c5695576af294b48cb63948883f0
Showing with 20 additions and 5 deletions.
  1. +20 −5 src/View/Helper/FormHelper.php
@@ -176,15 +176,30 @@ public function __construct(View $View, $settings = array()) {
parent::__construct($View, $settings);
$this->initStringTemplates($this->_defaultTemplates);
if (empty($settings['registry'])) {
$settings['registry'] = new InputRegistry($this->_templater, $settings['widgets']);
}
$this->_registry = $settings['registry'];
unset($this->settings['registry']);
$this->inputRegistry($settings['registry'], $settings['widgets']);
unset($this->settings['widgets'], $this->settings['registry']);
$this->_addDefaultContextProviders();
}
/**
* Set the input registry the helper will use.
*
* @param Cake\View\Widget\InputRegistry $instance The registry instance to set.
* @param array $widgets An array of widgets
* @return Cake\View\Widget\InputRegistry
*/
public function inputRegistry(InputRegistry $instance = null, $widgets = []) {
if ($instance === null) {
if ($this->_registry === null) {
$this->_registry = new InputRegistry($this->_templater, $widgets);
}
return $this->_registry;
}
$this->_registry = $instance;
return $this->_registry;
}
/**
* Add the default suite of context providers provided by CakePHP.
*

0 comments on commit 178c286

Please sign in to comment.
You can’t perform that action at this time.