Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static function type($type, $content = null, array $options = array())
- {
- $defaults =
- [
- 'view' => false,
- 'encode' => false,
- 'decode' => false,
- 'cast' => true,
- 'conditions' => [],
- 'paths' =>
- [
- 'template' => '{:lib}/views/{:controller}/{:template}.{:type}.php',
- 'layout' => '{:lib}/views/layouts/{:layout}.{:type}.php',
- 'element' => '{:lib}/views/elements/{:template}.{:type}.php'
- ]
- ];
- if($content === false)
- unset(static::$__types[$type], static::$__handlers[$type]);
- if(!$content && !$options)
- {
- if(!$content = static::__types($type))
- return;
- if(strpos($type, '/'))
- return $content;
- if(is_array($content) && isset($content['alias']))
- return static::type($content['alias']);
- return compact('content') + array('options' => static::handlers($type));
- }
- if($content)
- static::$__types[$type] = (array) $content;
- static::$__handlers[$type] = $options ? Set::merge($defaults, $options) : [];
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement