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


PHP PageLayout::setBodyElementId方法代码示例

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


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

示例1: perform

 /**
  * Hooked perform method in order to inject body element id creation.
  *
  * In order to avoid clashes, these body element id will be joined
  * with a minus sign. Otherwise the controller "x" with action
  * "y_z" would be given the same id as the controller "x/y" with
  * the action "z", namely "x_y_z". With the minus sign this will
  * result in the ids "x-y_z" and "x_y-z".
  *
  * Plugins will always have a leading 'plugin-' and the decamelized
  * plugin name in front of the id.
  *
  * @param String $unconsumed_path Path segment containing action and
  *                                optionally arguments or format
  * @return Trails_Response from parent controller
  */
 public function perform($unconsumed_path)
 {
     // Extract action from unconsumed path segment
     list($action) = $this->extract_action_and_args($unconsumed_path);
     // Extract decamelized controller name from class name
     $controller = preg_replace('/Controller$/', '', get_class($this));
     $controller = Trails_Inflector::underscore($controller);
     // Build main parts of the body element id
     $body_id_parts = explode('/', $controller);
     $body_id_parts[] = $action;
     // If the controller is from a plugin, Inject plugin identifier
     // and name of plugin
     if (basename($this->dispatcher->trails_uri, '.php') === 'plugins') {
         $plugin = basename($this->dispatcher->trails_root);
         $plugin = Trails_Inflector::underscore($plugin);
         array_unshift($body_id_parts, $plugin);
         array_unshift($body_id_parts, 'plugin');
     }
     // Create and set body element id
     $body_id = implode('-', $body_id_parts);
     PageLayout::setBodyElementId($body_id);
     return parent::perform($unconsumed_path);
 }
开发者ID:ratbird,项目名称:hope,代码行数:39,代码来源:studip_controller.php


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