当前位置: 首页>>代码示例>>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;未经允许,请勿转载。