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


PHP Widget::has_extension方法代码示例

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


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

示例1: onBeforeWrite

 public function onBeforeWrite()
 {
     parent::onBeforeWrite();
     if (!$this->Title) {
         $this->Title = Config::inst()->get($this->class, 'title');
     }
     if (Widget::has_extension('Versioned') && Versioned::current_stage() == 'Stage') {
         $this->publishAfterWrite = true;
     }
 }
开发者ID:nyeholt,项目名称:silverstripe-frontend-dashboards,代码行数:10,代码来源:Dashlet.php

示例2: onBeforeDelete

 public function onBeforeDelete()
 {
     if (Widget::has_extension('Versioned')) {
         $currentStage = Versioned::current_stage();
         Versioned::reading_stage('Stage');
         parent::onBeforeDelete();
         Versioned::reading_stage('Live');
         parent::onBeforeDelete();
         Versioned::reading_stage($currentStage);
     } else {
         parent::onBeforeDelete();
     }
 }
开发者ID:nyeholt,项目名称:silverstripe-frontend-dashboards,代码行数:13,代码来源:MemberDashboard.php

示例3: createDashboard

 public function createDashboard($name, $createDefault = false)
 {
     $url = preg_replace('/ +/', '-', trim($name));
     // Replace any spaces
     $url = preg_replace('/[^A-Za-z0-9.+_\\-]/', '', $url);
     // Replace non alphanumeric characters
     $url = strtolower($url);
     $existing = $this->getNamedDashboard($url);
     if ($existing) {
         return $existing;
     }
     $dashboard = new DashboardPage();
     $dashboard->URLSegment = $url;
     $dashboard->Title = trim($name);
     $dashboard->OwnerID = $this->owner->ID;
     $dashboard->write();
     if ($createDefault) {
         $currentStage = null;
         if (Widget::has_extension('Versioned')) {
             $currentStage = Versioned::current_stage();
             Versioned::reading_stage('Stage');
         }
         $layout = Config::inst()->get('DashboardUser', 'default_layout');
         if (count($layout)) {
             foreach ($layout as $type => $properties) {
                 if (class_exists($type)) {
                     $dashlet = $type::create();
                     /* @var $dashlet Dashlet */
                     $dashletColumn = isset($properties['DashletColumn']) ? $properties['DashletColumn'] : 0;
                     $db = $dashboard->getDashboard($dashletColumn);
                     if ($db && $dashlet->canCreate()) {
                         $dashlet->ParentID = $db->ID;
                         if (is_array($properties)) {
                             $dashlet->update($properties);
                         }
                         $dashlet->write();
                     }
                 }
             }
         }
         if ($currentStage) {
             Versioned::reading_stage($currentStage);
         }
         $dashboard = $this->getNamedDashboard($url);
         $this->owner->extend('updateCreatedDashboard', $dashboard);
     }
     return $dashboard;
 }
开发者ID:nyeholt,项目名称:silverstripe-frontend-dashboards,代码行数:48,代码来源:DashboardUser.php


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