View
AppViewが基底でViewを継承している。
自作のヘルパーなどはinitialize内で $this->loadHelper('MyUtils');してやることで使えるようになる。
View
EventDispatcherInterfaceを実装している。
使用しているtrait
CellTrait
EventDispatcherTrait;
LogTrait;
RequestActionTrait;
ViewVarsTrait;
変数
_helpers
Blocks
plugin
name ビューを作ったコントローラの名前
helpers ビルトインされているヘルパー
templatePath テンプレートのパス
template テンプレートの名前
layout 使用しているレイアウト
layoutPath 使用しているレイアウトの名前
autoLayout 自動レイアウトのonoff
_ext テンプレートの拡張子 デフォルトはctp
subDir
theme ビューのテーマ
hasRendered ビューがすでにレンダリングされているか
uuids 生成されたDOMのuuid
request
response
elementCache
_passedVars 関連するコントローラからの変数
_paths
_pathsForPlugin
_parents ビューの継承元。View::extend()で使用。
_current
_currentType
_stack ネストされたテンプレート。View::extend()で使用。
TYPE_TEMPLATE
TYPE_ELEMENT
TYPE_LAYOUT
メソッド
initialize()
templatePath($path = null) テンプレートのセットとゲット
layoutPath($path = null) レイアウトのセットとゲット
autoLayout($autoLayout = null)
theme($theme = null)
template($name = null)
layout($name = null)
element($name, array $data = , array $options = ) エレメントの描画。_renderElementを使う。
cache(callable $block, array $options = )
elementExists($name) エレメントがあるかのチェック
render($view = null, $layout = null) 与えられたテンプレートとレイアウトでレンダリングする。
renderLayout($content, $layout = null) レイアウトのレンダリング
getVars() $this->viewVarsの名前を返す
get($var, $default = null) view変数を取得
blocks() ビューブロックのキーを返す。$this->Blocks->keys();
start($name) ビューブロックのスタート $this->Blocks->start($name);
append($name, $value = null) ビューブロックの追加 $this->Blocks->concat($name, $value);
prepend($name, $value) $this->Blocks->concat($name, $value, ViewBlock::PREPEND);
assign($name, $value) ビューブロックのセット $this->Blocks->set($name, $value);
reset($name) ビューブロックのリセット $this->assign($name, '');
fetch($name, $default = '') ビューブロックのコンテンツを取得 $this->Blocks->get($name, $default);
end() ビューブロックのエンド $this->Blocks->end();
exists($name) ビューブロックの存在確認 $this->Blocks->exists($name);
extend($name) テンプレートの継承
uuid($object, $url) uuidの取得
getCurrentType()
__get($name)
__set($name, $value)
loadHelpers() ヘルパーの読み込み
_render($viewFile, $data = ) レンダリング
_evaluate($viewFile, $dataForView)
helpers() ヘルパー
loadHelper($name, array $config = []) ヘルパーの読み込み
_getViewFileName($name = null)
_inflectViewFileName($name)
_checkFilePath($file, $path)
pluginSplit($name, $fallback = true)
_getLayoutFileName($name = null)
_getElementFileName($name, $pluginCheck = true)
_getSubPaths($basePath)
_paths($plugin = null, $cached = true)
_elementCache($name, $data, $options)
_renderElement($file, $data, $options)