本文整理汇总了PHP中Cake\View\View::element方法的典型用法代码示例。如果您正苦于以下问题:PHP View::element方法的具体用法?PHP View::element怎么用?PHP View::element使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cake\View\View
的用法示例。
在下文中一共展示了View::element方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: formatter
/**
* Renders the given custom field.
*
* @param \Cake\View\View $view Instance of view class
* @param \Field\Model\Entity\Field $field The field to be rendered
* @return string HTML code
*/
public static function formatter($view, $field)
{
switch ($field->viewModeSettings['formatter']) {
case 'link':
$out = $view->element('Field.FileField/display_link', compact('field'));
break;
case 'table':
$out = $view->element('Field.FileField/display_table', compact('field'));
break;
case 'url':
default:
$out = $view->element('Field.FileField/display_url', compact('field'));
break;
}
return $out;
}
示例2: _addBlock
/**
* Adding Hooked element to given target.
*
* @param $type
* @param $blocks : Example:
* [
* 'Users/Users/index' => ['prepend' => false, 'element' => 'Bird.Actions/box1']
* 'Users/index' => ['prepend' => false, 'element' => 'Bird.Actions/box1']
* 'index' => ['prepend' => false, 'element' => 'Bird.Actions/box1']
* '*' => ['prepend' => false, 'element' => 'Bird.Actions/box1']
* ]
*/
protected function _addBlock($type, $blocks)
{
$plugin = $this->_View->request->param('plugin');
$controller = $this->_View->request->param('controller');
$action = $this->_View->request->param('action');
$target = [$action, $controller . '/' . $action, $plugin . '/' . $controller . '/' . $action];
$blockType = 'append';
foreach ($blocks as $path => $block) {
if ($path == '*' || in_array($path, $target)) {
if ($block['prepend']) {
$blockType = 'prepend';
}
$this->_View->{$blockType}($type, $this->_View->element($block['element']));
}
}
}
示例3: render
/**
* {@inheritDoc}
*/
public function render(View $view)
{
return $view->element('Captcha.ayah_render', ['ayah' => $this->_getLib()]);
}
示例4: form
/**
* Create and render edit/add admin action.
*
* @return mixed
*/
public function form()
{
return $this->_view->XmlForm->setName($this->getAlias())->setPath($this->_xmlFile())->setEntity($this->_entity)->setSets(['params'])->addTab('details', ['header' => __d('modules', 'Module details'), 'content' => $this->_view->element('Union/Modules.module_details')])->addTab('pages', ['header' => __d('modules', 'Binding to pages'), 'content' => $this->_view->Form->input('pages', ['default' => '*', 'label' => __d('modules', 'Show rules')])])->render(false);
}
示例5: render
/**
* {@inheritDoc}
*/
public function render(View $view)
{
return $view->element('Captcha.recaptcha_render', ['siteKey' => $this->config('siteKey')]);
}
示例6: View
<?php
use Cake\View\View;
$view = new View();
return ['button' => '<button{{attrs}}>{{text}}</button>', 'checkbox' => '<input type="checkbox" name="{{name}}" value="{{value}}"{{attrs}}>', 'checkboxFormGroup' => '<div class="col-xs-12 col-sm-8 col-sm-offset-4 col-md-9 col-md-offset-3 checkbox">{{label}}</div>', 'checkboxWrapper' => '<div class="checkbox">{{label}}</div>', 'dateWidget' => '{{year}}{{month}}{{day}}{{hour}}{{minute}}{{second}}{{meridian}}', 'error' => '<div class="error-message col-xs-12 col-sm-8 col-md-9 col-sm-offset-4 col-md-offset-3 col-lg-10 col-lg-offset-2">{{content}}</div>', 'errorList' => '<ul>{{content}}</ul>', 'errorItem' => '<li>{{text}}</li>', 'file' => '<input type="file" name="{{name}}"{{attrs}}>', 'fieldset' => '<fieldset>{{content}}</fieldset>', 'formstart' => '<form{{attrs}}>', 'formend' => '</form>', 'formGroup' => '{{label}}<div class="col-xs-12 col-sm-8 col-md-9 col-lg-10">{{input}}</div>', 'hiddenblock' => '<div style="display:none;">{{content}}</div>', 'input' => '<input type="{{type}}" name="{{name}}"{{attrs}}>', 'inputsubmit' => '<input type="{{type}}"{{attrs}}>', 'inputContainer' => '<div class="input row {{type}}{{required}}">{{content}}</div>', 'inputContainerError' => '<div class="input row {{type}}{{required}} error">{{content}}{{error}}</div>', 'label' => '<div class="col-xs-12 col-sm-4 col-md-3 col-lg-2"><label{{attrs}}>{{text}}</label></div>', 'nestingLabel' => '<label{{attrs}}>{{input}}{{text}}</label>', 'legend' => '<legend>{{text}}</legend>', 'option' => '<option value="{{value}}"{{attrs}}>{{text}}</option>', 'optgroup' => '<optgroup label="{{label}}"{{attrs}}>{{content}}</optgroup>', 'select' => '<select name="{{name}}"{{attrs}}>{{content}}</select>', 'selectMultiple' => '<select name="{{name}}[]" multiple="multiple"{{attrs}}>{{content}}</select>', 'radio' => '<input type="radio" name="{{name}}" value="{{value}}"{{attrs}}>', 'radioWrapper' => '{{label}}', 'textarea' => '<textarea name="{{name}}"{{attrs}}>{{value}}</textarea>', 'submitContainer' => '<div class="submit">{{content}}</div>', 'customFile' => $view->element('Painel.Form/customFile'), 'picture' => $view->element('Painel.Form/picture')];