/** * @inheritdoc * @todo : refactor prefix and sufffix concatenation */ protected function process($name, $tag, $additions = array()) { // Extracted variables are label, prefix and postfix extract($additions); $has_error = false; $error_message = ''; $errors = $this->edifice->getErrors($name); if (sizeof($errors) > 0) { $has_error = true; $error_message = $this->getErrorElement($errors); } $result = $this->openRow($has_error, isset($prefix), isset($postfix)); if (isset($label['label'])) { $label['label'] = preg_replace('/>/', '>' . $tag, $label['label'], 1); $result .= html_entity_decode($label['label']) . $this->closeRow(); } elseif (isset($prefix) || isset($postfix)) { if (isset($prefix)) { $input_tag = create_div(array('class' => 'small-8 large-8 columns'), $tag . $error_message); $result .= $prefix . $input_tag; } if (isset($postfix)) { $input_tag = create_div(array('class' => 'small-8 large-8 columns'), $tag . $error_message); $result .= $input_tag . $postfix; } $result .= $this->closeRow(); } else { $result .= $tag . $error_message . $this->closeRow(); } return $result; }
/** * Processes the form input postfix. * * @param string $name Form input name * @param array $options Form input options, label options will be extracted * * @return string */ protected function processPostfix($name, &$options) { $postfix_tag = null; if (array_key_exists('postfix', $options)) { $postfix = array_pull($options, 'postfix'); if (array_key_exists('text', $postfix)) { $text = array_pull($postfix, 'text'); $postfix_tag = $postfix_tag = create_div(array('class' => 'small-4 large-4 columns'), '<span class="postfix">' . $text . '</span>'); } } return $postfix_tag; }
$topic_count += $group['topic_count']; } $topic_per_div = round($topic_count / 2); // make html $html = ""; $limit = $topic_per_div; $topic_count = 0; foreach ($toc as $group) { // group $html .= '<b>'; $html .= anchor(site_url($cms["module_path"] . "/help/group/" . $group['url']), $group['name']); $html .= '</b>'; // topic $html .= '<ul>'; foreach ($group['topics'] as $topic) { $html .= '<li>'; $html .= anchor(site_url($cms["module_path"] . "/help/topic/" . $topic['url']), $topic['title']); $html .= '</li>'; } $html .= '</ul>'; $topic_count += $group['topic_count']; if ($topic_count > $limit) { create_div($html); $topic_count = 0; $html = ''; } } if ($html != '') { create_div($html); } echo '<div style="clear:both;"></div>';