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


PHP CRM_Core_Resources::addStyleUrl方法代码示例

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


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

示例1: testAddStyleURL

 public function testAddStyleURL()
 {
     $this->res->addStyleUrl('/whiz/foo%20bar.css', 0, 'testAddStyleURL')->addStyleUrl('/whiz/foo%20bar.css', 0, 'testAddStyleURL')->addStyleUrl('/whizbang/foo%20bar.css', 0, 'testAddStyleURL');
     $smarty = CRM_Core_Smarty::singleton();
     $actual = $smarty->fetch('string:{crmRegion name=testAddStyleURL}{/crmRegion}');
     $expected = "" . "<link href=\"/whiz/foo%20bar.css\" rel=\"stylesheet\" type=\"text/css\"/>\n" . "<link href=\"/whizbang/foo%20bar.css\" rel=\"stylesheet\" type=\"text/css\"/>\n";
     $this->assertEquals($expected, $actual);
 }
开发者ID:FundingWorks,项目名称:civicrm-core,代码行数:8,代码来源:ResourcesTest.php

示例2: registerResources

 /**
  * Register resources required by Angular.
  */
 public function registerResources()
 {
     $modules = $this->angular->getModules();
     $page = $this;
     // PHP 5.3 does not propagate $this to inner functions.
     $this->res->addSettingsFactory(function () use(&$modules, $page) {
         // TODO optimization; client-side caching
         return array_merge($page->angular->getResources(array_keys($modules), 'settings', 'settings'), array('resourceUrls' => \CRM_Extension_System::singleton()->getMapper()->getActiveModuleUrls(), 'angular' => array('modules' => array_merge(array('ngRoute'), array_keys($modules)), 'cacheCode' => $page->res->getCacheCode())));
     });
     $this->res->addScriptFile('civicrm', 'bower_components/angular/angular.min.js', 100, $this->region, FALSE);
     $headOffset = 0;
     $config = \CRM_Core_Config::singleton();
     if ($config->debug) {
         foreach ($modules as $moduleName => $module) {
             foreach ($this->angular->getResources($moduleName, 'css', 'cacheUrl') as $url) {
                 $this->res->addStyleUrl($url, self::DEFAULT_MODULE_WEIGHT + ++$headOffset, $this->region);
             }
             foreach ($this->angular->getResources($moduleName, 'js', 'cacheUrl') as $url) {
                 $this->res->addScriptUrl($url, self::DEFAULT_MODULE_WEIGHT + ++$headOffset, $this->region);
                 // addScriptUrl() bypasses the normal string-localization of addScriptFile(),
                 // but that's OK because all Angular strings (JS+HTML) will load via crmResource.
             }
         }
     } else {
         // Note: addScriptUrl() bypasses the normal string-localization of addScriptFile(),
         // but that's OK because all Angular strings (JS+HTML) will load via crmResource.
         $aggScriptUrl = \CRM_Utils_System::url('civicrm/ajax/angular-modules', 'format=js&r=' . $page->res->getCacheCode(), FALSE, NULL, FALSE);
         $this->res->addScriptUrl($aggScriptUrl, 120, $this->region);
         // FIXME: The following CSS aggregator doesn't currently handle path-adjustments - which can break icons.
         //$aggStyleUrl = \CRM_Utils_System::url('civicrm/ajax/angular-modules', 'format=css&r=' . $page->res->getCacheCode(), FALSE, NULL, FALSE);
         //$this->res->addStyleUrl($aggStyleUrl, 120, $this->region);
         foreach ($this->angular->getResources(array_keys($modules), 'css', 'cacheUrl') as $url) {
             $this->res->addStyleUrl($url, self::DEFAULT_MODULE_WEIGHT + ++$headOffset, $this->region);
         }
     }
     // If trying to load an Angular page via AJAX, the route must be passed as a
     // URL parameter, since the server doesn't receive information about
     // URL fragments (i.e, what comes after the #).
     \CRM_Core_Resources::singleton()->addSetting(array('angularRoute' => \CRM_Utils_Request::retrieve('route', 'String')));
 }
开发者ID:nganivet,项目名称:civicrm-core,代码行数:43,代码来源:Main.php

示例3: registerResources

 /**
  * Register resources required by Angular.
  */
 public function registerResources()
 {
     $modules = $this->angular->getModules();
     $page = $this;
     // PHP 5.3 does not propagate $this to inner functions.
     $this->res->addSettingsFactory(function () use(&$modules, $page) {
         // TODO optimization; client-side caching
         return array_merge($page->angular->getResources(array_keys($modules), 'settings', 'settings'), array('resourceUrls' => \CRM_Extension_System::singleton()->getMapper()->getActiveModuleUrls(), 'angular' => array('modules' => array_merge(array('ngRoute'), array_keys($modules)), 'cacheCode' => $page->res->getCacheCode())));
     });
     $this->res->addScriptFile('civicrm', 'bower_components/angular/angular.min.js', 100, 'html-header', FALSE);
     // FIXME: crmUi depends on loading ckeditor, but ckeditor doesn't work with this aggregation.
     $this->res->addScriptFile('civicrm', 'packages/ckeditor/ckeditor.js', 100, 'page-header', FALSE);
     $headOffset = 0;
     $config = \CRM_Core_Config::singleton();
     if ($config->debug) {
         foreach ($modules as $moduleName => $module) {
             foreach ($this->angular->getResources($moduleName, 'css', 'cacheUrl') as $url) {
                 $this->res->addStyleUrl($url, self::DEFAULT_MODULE_WEIGHT + ++$headOffset, 'html-header');
             }
             foreach ($this->angular->getResources($moduleName, 'js', 'cacheUrl') as $url) {
                 $this->res->addScriptUrl($url, self::DEFAULT_MODULE_WEIGHT + ++$headOffset, 'html-header');
                 // addScriptUrl() bypasses the normal string-localization of addScriptFile(),
                 // but that's OK because all Angular strings (JS+HTML) will load via crmResource.
             }
         }
     } else {
         // Note: addScriptUrl() bypasses the normal string-localization of addScriptFile(),
         // but that's OK because all Angular strings (JS+HTML) will load via crmResource.
         $aggScriptUrl = \CRM_Utils_System::url('civicrm/ajax/angular-modules', 'format=js&r=' . $page->res->getCacheCode(), FALSE, NULL, FALSE);
         $this->res->addScriptUrl($aggScriptUrl, 120, 'html-header');
         // FIXME: The following CSS aggregator doesn't currently handle path-adjustments - which can break icons.
         //$aggStyleUrl = \CRM_Utils_System::url('civicrm/ajax/angular-modules', 'format=css&r=' . $page->res->getCacheCode(), FALSE, NULL, FALSE);
         //$this->res->addStyleUrl($aggStyleUrl, 120, 'html-header');
         foreach ($this->angular->getResources(array_keys($modules), 'css', 'cacheUrl') as $url) {
             $this->res->addStyleUrl($url, self::DEFAULT_MODULE_WEIGHT + ++$headOffset, 'html-header');
         }
     }
 }
开发者ID:kidaa30,项目名称:yes,代码行数:41,代码来源:Main.php


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