diff --git a/e107_handlers/form_handler.php b/e107_handlers/form_handler.php index 650c3b9d7..34182e8d2 100644 --- a/e107_handlers/form_handler.php +++ b/e107_handlers/form_handler.php @@ -63,11 +63,12 @@ if (!defined('e107_INIT')) { exit; } */ class e_form { - protected $_tabindex_counter = 0; - protected $_tabindex_enabled = true; - protected $_cached_attributes = array(); - protected $_field_warnings = array(); - private $_inline_token = null; + protected $_tabindex_counter = 0; + protected $_tabindex_enabled = true; + protected $_cached_attributes = array(); + protected $_field_warnings = array(); + private $_inline_token = null; + public $_snippets = false; // use snippets or not. - experimental, and may be removed - use at own risk. /** * @var user_class @@ -82,6 +83,8 @@ class e_form $this->_tabindex_enabled = $enable_tabindex; $this->_uc = e107::getUserClass(); $this->setRequiredString(' *'); + + } /** @@ -2402,6 +2405,31 @@ class e_form } + /** + * Checks for a theme snippet and returns it + * @param string $type + * @return string|false + */ + private function getSnippet($type) + { + if(deftrue('e_ADMIN_AREA') || $this->_snippets === false) + { + return false; + } + + $snippet = THEME."snippets/form_".$type.".html"; + + if(!file_exists($snippet)) + { + return false; + } + + return file_get_contents($snippet, false, null, 0, 1024); + + } + + + /** * Render a checkbox * @param string $name @@ -2434,6 +2462,7 @@ class e_form $text = ""; + $active = ($checked === true) ? " active" : ""; // allow for styling if needed. if(!empty($options['label'])) // add attributes to