aea946dc2e1e9f7b37d6054dec691d9a3f8c44ad

Author: Predominant

Date: 2009-10-15 15:13:04 +1100

Added element method to ApiUtils helper. Added optional elements to class view elements.

diff --git a/views/elements/class_info.ctp b/views/elements/class_info.ctp index f3f57b2..0222e28 100644 --- a/views/elements/class_info.ctp +++ b/views/elements/class_info.ctp @@ -3,6 +3,7 @@ * Class information element * */ +echo $apiUtils->element('before_class_info'); ?> <a id="class-<?php echo $doc->name; ?>"></a> <div class="doc-block class-info"> @@ -35,4 +36,5 @@ </dl> <?php echo $this->element('tag_block', array('tags' => $doc->classInfo['comment']['tags'])); ?> </div> -</div> \ No newline at end of file +</div> +<?php echo $apiUtils->element('after_class_info'); ?> \ No newline at end of file diff --git a/views/elements/method_detail.ctp b/views/elements/method_detail.ctp index 0f87494..3d5a045 100644 --- a/views/elements/method_detail.ctp +++ b/views/elements/method_detail.ctp @@ -3,6 +3,7 @@ * Method Detail element * */ +echo $apiUtils->element('before_method_detail'); ?> <?php foreach ($doc->methods as $method): if ($apiDoc->excluded($method['access'], 'method')) : @@ -62,4 +63,7 @@ <?php echo $this->element('tag_block', array('tags' => $method['comment']['tags'])); ?> </div> </div> -<?php endforeach; ?> \ No newline at end of file +<?php +endforeach; +echo $apiUtils->element('after_method_detail'); +?> \ No newline at end of file diff --git a/views/elements/method_summary.ctp b/views/elements/method_summary.ctp index 0bcec02..52ba17d 100644 --- a/views/elements/method_summary.ctp +++ b/views/elements/method_summary.ctp @@ -3,7 +3,7 @@ * Method Summary Element * */ - +echo $apiUtils->element('before_method_summary'); $apiUtils->sortByName($doc->methods); $title = (empty($isSearch)) ? __('Method Summary:', true) : __('Methods:', true); ?> @@ -50,4 +50,5 @@ $title = (empty($isSearch)) ? __('Method Summary:', true) : __('Methods:', true) </tbody> </table> </div> -</div> \ No newline at end of file +</div> +<?php echo $apiUtils->element('after_method_summary'); ?> \ No newline at end of file diff --git a/views/elements/properties.ctp b/views/elements/properties.ctp index 9aaf1ab..01d9f56 100644 --- a/views/elements/properties.ctp +++ b/views/elements/properties.ctp @@ -3,6 +3,7 @@ * Properties Element * */ +echo $apiUtils->element('before_properties'); $apiUtils->sortByName($doc->properties); ?> <div class="doc-block"> @@ -33,4 +34,5 @@ $apiUtils->sortByName($doc->properties); </table> <?php endif; ?> </div> -</div> \ No newline at end of file +</div> +<?php echo $apiUtils->element('after_properties'); ?> \ No newline at end of file diff --git a/views/helpers/api_utils.php b/views/helpers/api_utils.php index 81244ab..31f0e86 100644 --- a/views/helpers/api_utils.php +++ b/views/helpers/api_utils.php @@ -173,4 +173,25 @@ HTML; $cleanTwo = str_replace('_', '', $two['name']); return strnatcasecmp($cleanOne, $cleanTwo); } +/** + * Element inclusion, checks for file existence first, and if exists, passes to regular view helper + * + * @param string $name + * @param string $params + * @param string $loadHelpers + * @return string + * @access public + */ + public function element($name, $params = array(), $loadHelpers = false) { + $file = $plugin = $key = null; + $view = ClassRegistry::getObject('view'); + $paths = $view->_paths($this->plugin); + + foreach ($paths as $path) { + if (file_exists($path . 'elements' . DS . $name . $view->ext)) { + return $view->element($name, $params, $loadHelpers); + } + } + return ''; + } } \ No newline at end of file