當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CMSMenu::get_cms_classes方法代碼示例

本文整理匯總了PHP中CMSMenu::get_cms_classes方法的典型用法代碼示例。如果您正苦於以下問題:PHP CMSMenu::get_cms_classes方法的具體用法?PHP CMSMenu::get_cms_classes怎麽用?PHP CMSMenu::get_cms_classes使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在CMSMenu的用法示例。


在下文中一共展示了CMSMenu::get_cms_classes方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testCmsClassDetection

 public function testCmsClassDetection()
 {
     // Get CMS classes and check that:
     //	1.) SecurityAdmin is included
     //	2.) LeftAndMain & ModelAdmin are excluded
     $cmsClasses = CMSMenu::get_cms_classes();
     $this->assertContains('SecurityAdmin', $cmsClasses, 'SecurityAdmin included in valid CMS Classes');
     $this->assertNotContains('LeftAndMain', $cmsClasses, 'LeftAndMain not included in valid CMS Classes');
     $this->assertNotContains('ModelAdmin', $cmsClasses, 'LeftAndMain not included in valid CMS Classes');
 }
開發者ID:ivoba,項目名稱:silverstripe-framework,代碼行數:10,代碼來源:CMSMenuTest.php

示例2: rules

 /**
  * Gets a list of url_pattern => controller k/v pairs for each LeftAndMain derived controller
  */
 public static function rules()
 {
     if (self::$_rules === null) {
         self::$_rules = array();
         // Map over the array calling add_rule_for_controller on each
         $classes = CMSMenu::get_cms_classes(null, true, CMSMenu::URL_PRIORITY);
         array_map(array(__CLASS__, 'add_rule_for_controller'), $classes);
     }
     return self::$_rules;
 }
開發者ID:jacobbuck,項目名稱:silverstripe-framework,代碼行數:13,代碼來源:AdminRootController.php

示例3: rules

 /**
  * Gets a list of url_pattern => controller k/v pairs for each LeftAndMain derived controller
  */
 public static function rules()
 {
     if (self::$_rules === null) {
         self::$_rules = array();
         // Build an array of class => url_priority k/v pairs
         $classes = array();
         foreach (CMSMenu::get_cms_classes() as $class) {
             $classes[$class] = Config::inst()->get($class, 'url_priority', Config::FIRST_SET);
         }
         // Sort them so highest priority item is first
         arsort($classes, SORT_NUMERIC);
         // Map over the array calling add_rule_for_controller on each
         array_map(array(__CLASS__, 'add_rule_for_controller'), array_keys($classes));
     }
     return self::$_rules;
 }
開發者ID:prostart,項目名稱:cobblestonepath,代碼行數:19,代碼來源:AdminRootController.php

示例4: ListOfAllModelAdmins

 /**
  * returns a list of all model admin links
  * @return Array(String)
  */
 private function ListOfAllModelAdmins()
 {
     $models = array();
     $modelAdmins = CMSMenu::get_cms_classes("ModelAdmin");
     if ($modelAdmins && count($modelAdmins)) {
         foreach ($modelAdmins as $modelAdmin) {
             if ($modelAdmin != "ModelAdminEcommerceBaseClass") {
                 $obj = singleton($modelAdmin);
                 $modelAdminLink = $obj->Link();
                 $models[] = $modelAdminLink;
                 $modelsToAdd = $obj->getManagedModels();
                 if ($modelsToAdd && count($modelsToAdd)) {
                     foreach ($modelsToAdd as $key => $model) {
                         if (is_array($model) || !is_subclass_of($model, "DataObject")) {
                             $model = $key;
                         }
                         if (!is_subclass_of($model, "DataObject")) {
                             continue;
                         }
                         $modelLink = $modelAdminLink . $model . "/";
                         $models[] = $modelLink;
                         $models[] = $modelLink . "EditForm/field/" . $model . "/item/new/";
                         if ($item = $model::get()->First()) {
                             $models[] = $modelLink . "EditForm/field/" . $model . "/item/" . $item->ID . "/edit";
                         }
                     }
                 }
             }
         }
     }
     return $models;
 }
開發者ID:helpfulrobot,項目名稱:purplespider-mypswd-tweaks,代碼行數:36,代碼來源:CheckAllTemplates.php

示例5: getCombinedClientConfig

 /**
  * Gets the combined configuration of all LeafAndMain subclasses required by the client app.
  *
  * @return array
  *
  * WARNING: Experimental API
  */
 public function getCombinedClientConfig()
 {
     $combinedClientConfig = ['sections' => []];
     $cmsClassNames = CMSMenu::get_cms_classes('LeftAndMain', true, CMSMenu::URL_PRIORITY);
     foreach ($cmsClassNames as $className) {
         $combinedClientConfig['sections'][$className] = Injector::inst()->get($className)->getClientConfig();
     }
     // Pass in base url (absolute and relative)
     $combinedClientConfig['baseUrl'] = Director::baseURL();
     $combinedClientConfig['absoluteBaseUrl'] = Director::absoluteBaseURL();
     $combinedClientConfig['adminUrl'] = AdminRootController::admin_url();
     // Get "global" CSRF token for use in JavaScript
     $token = SecurityToken::inst();
     $combinedClientConfig[$token->getName()] = $token->getValue();
     // Set env
     $combinedClientConfig['environment'] = Director::get_environment_type();
     $combinedClientConfig['debugging'] = $this->config()->client_debugging;
     return Convert::raw2json($combinedClientConfig);
 }
開發者ID:jacobbuck,項目名稱:silverstripe-framework,代碼行數:26,代碼來源:LeftAndMain.php


注:本文中的CMSMenu::get_cms_classes方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。