本文整理汇总了PHP中App\Controller\AppController::beforeRender方法的典型用法代码示例。如果您正苦于以下问题:PHP AppController::beforeRender方法的具体用法?PHP AppController::beforeRender怎么用?PHP AppController::beforeRender使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类App\Controller\AppController
的用法示例。
在下文中一共展示了AppController::beforeRender方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: beforeRender
/**
* beforeRender Event
*
* @param Event $event Event
* @return void
*/
public function beforeRender(Event $event)
{
if ($this->_adminAreaIntegration) {
$this->_setupAdminAreaIntegration();
}
parent::beforeRender($event);
}
示例2: beforeRender
/**
* Before render callback.
*
* @param \Cake\Event\Event $event The beforeRender event.
* @return void
*/
public function beforeRender(Event $event)
{
parent::beforeRender($event);
$params = $this->request->params;
$page_id = Inflector::dasherize(implode('-', array_merge([$params['controller']], $params['pass'])));
$this->set(compact('page_id'));
}
示例3: beforeRender
/**
* @param Event $event
*/
public function beforeRender(Event $event)
{
if (!$this->request->session()->read('Core.Users')) {
return $this->redirect('/');
}
$this->set('imageFields', $this->imageFields);
parent::beforeRender($event);
// TODO: Change the autogenerated stub
}
示例4: beforeRender
/**
* The Second run
* Overwrite beforeRender
* Return response is json type
*/
public function beforeRender(Event $event)
{
parent::beforeRender($event);
$this->response->type('json');
// Add hock if check validdate error
if (!$this->checkValidRequest) {
$this->response->body(json_encode(array('result_code' => $this->result_code, 'result_detail' => $this->result_detail, 'result_error' => $this->result_error)));
return $this->response;
$this->_stop();
}
}
示例5: beforeRender
/**
* beforeRender Event
*
* @param Event $event Event
* @return void
*/
public function beforeRender(Event $event)
{
// For good integration in existing administration areas, configure
// View things here.
if (method_exists($this, 'getView')) {
// CakePHP 3.0.x
$view = $this->getView();
$view->layout = Configure::read('Notifications.Administration.layout');
foreach (Configure::read('Notifications.Administration.helpers') as $helper) {
$view->loadHelper($helper);
}
} else {
// CakePHP 3.1.x
$this->viewBuilder()->helpers(Configure::read('Notifications.Administration.helpers'));
$this->viewBuilder()->layout(Configure::read('Notifications.Administration.layout'));
}
parent::beforeRender($event);
}
示例6: beforeRender
public function beforeRender(\Cake\Event\Event $event)
{
parent::beforeRender($event);
if ($this->Entity) {
$errors = [];
if ($this->Entity->errors()) {
foreach ($this->Entity->errors() as $field => $item) {
$errors[$field] = array_values($item)[0];
}
}
if ($errors) {
$this->Output['status'] = API_STATUS_ERROR;
$this->Output['error_code'] = ERROR_INVALID_VALIDATION;
$this->Output['errors'] = $errors;
}
}
$this->writeOutput();
}
示例7: beforeRender
/**
* beforeRender
*
* @param \Cake\Event\Event $event Event.
* @return void
*/
public function beforeRender(\Cake\Event\Event $event)
{
parent::beforeRender($event);
$this->set('postType', $this->Settings);
}
示例8: beforeRender
public function beforeRender(Event $event)
{
$this->breadcrumbs[] = ['label' => __('City'), 'link' => ['action' => 'index']];
switch ($this->request->params['action']) {
case 'view':
$this->breadcrumbs[] = ['label' => __('View')];
break;
case 'add':
$this->breadcrumbs[] = ['label' => __('Add'), 'link' => NULL];
break;
case 'edit':
$this->breadcrumbs[] = ['label' => __('Edit')];
$this->breadcrumbs[] = ['label' => $this->cityData->name];
break;
}
parent::beforeRender($event);
}
示例9: beforeRender
public function beforeRender(\Cake\Event\Event $event)
{
parent::beforeRender($event);
$this->set('title', 'Lançamento');
}
示例10: beforeRender
/**
* before render view
* @param Event $event
*/
public function beforeRender(Event $event)
{
parent::beforeRender($event);
// TODO: Change the autogenerated stub
$this->set(['titleLayout' => $this->titleLayout, 'metaDescription' => $this->descriptionMeta, 'metaKeywords' => $this->keywordsMeta, 'sidebarLeft' => $this->sidebarLeft, 'sidebarRight' => $this->sidebarRight, 'fieldLanguage' => $this->fieldLanguage]);
$this->getAdvertisements();
$this->getBanners();
$leftIndustries = $this->JcApiModel->getListData('industries', 0, 20, array(), MEMBER_COMPANY_COUNTRY_VIETNAM);
if ($this->sidebarLeft) {
$this->set('leftIndustries', $leftIndustries);
}
if ($this->sidebarRight) {
$listEvents = $this->Activities->find('all', ['conditions' => ['sidebar_right' => true], 'order' => 'modified DESC', 'limit' => 2]);
$listMagazines = $this->Events->find('all', ['order' => 'modified DESC', 'limit' => 2]);
if ($listEvents) {
$listEvents = $listEvents->toArray();
}
if ($listMagazines) {
$listMagazines = $listMagazines->toArray();
}
$this->set('listEvents', $listEvents);
$this->set('listMagazines', $listMagazines);
}
}
示例11: beforeRender
/**
* beforeRender callback.
*
* @param \Cake\Event\Event $event Event.
* @return void
*/
public function beforeRender(Event $event)
{
parent::beforeRender($event);
$this->viewBuilder()->templatePath('Error');
$this->viewVars['page_id'] = 'error-index';
}
示例12: beforeRender
public function beforeRender(Event $event)
{
parent::beforeRender($event);
$users = TableRegistry::get('Users');
$this->set('FirstUser', $users->find('all')->first());
}
示例13: beforeRender
public function beforeRender(Event $event)
{
$this->set('types', $this->types);
parent::beforeRender($event);
}
示例14: beforeRender
/**
* beforeRender method
*
* @param \Cake\Event\Event $event Event
* @return void
*/
public function beforeRender(\Cake\Event\Event $event)
{
parent::beforeRender($event);
$this->viewBuilder()->helpers(['GoogleCharts.GoogleCharts']);
}
示例15: beforeRender
public function beforeRender(Event $event)
{
$this->breadcrumbs[] = array('label' => __('User'), 'link' => array('controller' => 'Users', 'action' => 'index'));
switch ($this->request->params['action']) {
default:
$this->showBreadcrumb = FALSE;
break;
case 'index':
break;
case 'add':
$this->breadcrumbs[] = array('label' => __('Add'));
break;
case 'edit':
$this->breadcrumbs[] = array('label' => __('Edit'));
$this->breadcrumbs[] = array('label' => $this->userData->first_name . ' ' . $this->userData->last_name);
break;
}
parent::beforeRender($event);
}