當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。