Permalink
Browse files

fixed the implementation of themes

  • Loading branch information...
Zeelot committed Jul 19, 2010
1 parent 6d08980 commit 3a755f94323fa1c290ba8f786178083d13ab47e3
Showing with 13 additions and 1 deletion.
  1. +5 −1 classes/yuriko/yform.php
  2. +8 −0 classes/yuriko/yform/element.php
View
@@ -60,13 +60,15 @@ public static function factory($name = NULL, $group = 'default')
* @var object
*/
protected $_form;
+ protected $_name;
public function __construct($name = NULL, $group = 'default')
{
$config = Kohana::config('yform.'.$group);
$this->_settings = array_merge($this->_settings, $config);
- $this->_form = $this->form($name);
+ // Store the name for when we create the form element in open()
+ $this->_name = $name;
}
/**
@@ -201,6 +203,8 @@ public function __get($key)
*/
public function open($action = NULL, array $attributes = array())
{
+ // Create the form element before rendering it
+ $this->_form = $this->form($this->_name);
return $this->_form->open($action, $attributes);
}
@@ -88,6 +88,9 @@ public function load_settings(YForm $settings)
// Using the dot-notated path to grab messages
$this->_messages = Arr::merge($this->_messages, $settings->get_messages($this->_path, array()));
+ // Replace the default theme in this element
+ $this->set_theme($settings->theme);
+
return $this;
}
@@ -257,6 +260,11 @@ public function get_messages()
return $this->_messages;
}
+ public function set_theme($name)
+ {
+ $this->_theme = $name;
+ }
+
public function set_label($label)
{
$this->_label = $label;

0 comments on commit 3a755f9

Please sign in to comment.