当前位置: 首页>>代码示例>>PHP>>正文


PHP Events::extendPageType方法代码示例

本文整理汇总了PHP中Events::extendPageType方法的典型用法代码示例。如果您正苦于以下问题:PHP Events::extendPageType方法的具体用法?PHP Events::extendPageType怎么用?PHP Events::extendPageType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Events的用法示例。


在下文中一共展示了Events::extendPageType方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: extendPageType

	/** 
	 * When passed an "event" as a string, a user-defined method will be run INSIDE this page's controller
	 * whenever an event takes place. The name/location of this event is not customizable. If you want more
	 * customization, used extend() below.
	 */
	public static function extendPageType($ctHandle, $event = false, $params = array()) {
		Events::enableEvents();
		if ($event == false) {
			// then we're registering ALL the page type events for this particular page type
			Events::extendPageType($ctHandle, 'on_page_add', $params);
			Events::extendPageType($ctHandle, 'on_page_update', $params);
			Events::extendPageType($ctHandle, 'on_page_duplicate', $params);
			Events::extendPageType($ctHandle, 'on_page_move', $params);
			Events::extendPageType($ctHandle, 'on_page_view', $params);
			Events::extendPageType($ctHandle, 'on_page_version_approve', $params);
			Events::extendPageType($ctHandle, 'on_page_delete', $params);
		} else {
			$ce = Events::getInstance();
			$class = Object::camelcase($ctHandle) . 'PageTypeController';
			$method = $event;
			$filename = Loader::pageTypeControllerPath($ctHandle);
			$ce->registeredEvents[$event][] = array(
				Events::EVENT_TYPE_PAGETYPE,
				$class,
				$method,
				$filename,
				$params
			);
		}
	}
开发者ID:rii-J,项目名称:concrete5-de,代码行数:30,代码来源:events.php

示例2: on_start

 public function on_start()
 {
     //		stuff here will run on every page request before anything else.
     //		if full page cache is turned on, this will not run on cached pages
     //
     //		events are the most common use case
     //		for more details on events, check out the documentation here:
     //		http://www.concrete5.org/documentation/developers/system/events
     //
     Events::extendPageType('boilerplate', 'on_page_add');
     $html = Loader::helper("html");
     $v = View::getInstance();
     $v->addHeaderItem($html->css("boilerplate.css", "c5_boilerplate"));
     $v->addHeaderItem($html->javascript("boilerplate.js", "c5_boilerplate"));
 }
开发者ID:janzenz,项目名称:c5_boilerplate,代码行数:15,代码来源:controller.php

示例3:

<?php

Events::extendPageType('walk', 'on_page_update');
// Setup user when created
Events::extend('on_user_add', '\\JanesWalk\\Models\\Users\\WalkLeader', 'setupUserJoinInfo', 'models/users/WalkLeader.php');
开发者ID:r-bansal,项目名称:janeswalk-web-1,代码行数:5,代码来源:site_events.php


注:本文中的Events::extendPageType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。