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


PHP Page::onBeforeWrite方法代码示例

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


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

示例1: onBeforeWrite

 public function onBeforeWrite()
 {
     parent::onBeforeWrite();
     if (!$this->Content) {
         $this->Content = '<p>$List</p>';
     }
 }
开发者ID:helpfulrobot,项目名称:silverstripe-australia-frontend-objects,代码行数:7,代码来源:ItemListPage.php

示例2: onBeforeWrite

 /**
  * Iterate through all the modules and add their content to the parent page, so it can be found in searches.
  */
 public function onBeforeWrite()
 {
     $pageClass = get_called_class();
     // Behaviour can be disabled via the config
     $writeContent = Config::inst()->get($pageClass, 'write_content');
     // If a custom config doesn't exist, check ModularPage
     if (is_null($writeContent)) {
         $writeContent = Config::inst()->get('ModularPage', 'write_content');
     }
     if ($writeContent) {
         $classes = ClassInfo::subclassesFor(__CLASS__);
         // Only run this code if we're on a valid instance of this class.
         // Fixes bug when changaing page type via the CMS (e.g. ModularPage -> Page)
         if (in_array($this->ClassName, $classes)) {
             if ($this->Modules()->Count()) {
                 $searchBody = '';
                 foreach ($this->Modules() as $module) {
                     $searchBody .= $module->getSearchBody() . PHP_EOL;
                 }
                 $this->Content = $searchBody;
             }
         }
     }
     parent::onBeforeWrite();
 }
开发者ID:touchcast,项目名称:modulator,代码行数:28,代码来源:ModularPage.php

示例3: onBeforeWrite

 /**
  * If no publish date is set, set the date to now.
  **/
 public function onBeforeWrite()
 {
     parent::onBeforeWrite();
     if (!$this->PublishDate) {
         $this->setCastedField("PublishDate", time());
     }
 }
开发者ID:helpfulrobot,项目名称:micmania1-silverstripe-blog,代码行数:10,代码来源:BlogPost.php

示例4: onBeforeWrite

 function onBeforeWrite()
 {
     parent::onBeforeWrite();
     if ($this->ID) {
         $this->RootFolder()->Title = $this->Title;
     }
 }
开发者ID:SustainableCoastlines,项目名称:loveyourwater,代码行数:7,代码来源:ImageGalleryPage.php

示例5: onBeforeWrite

 public function onBeforeWrite()
 {
     if (!$this->ID) {
         $this->isInsert = true;
     }
     parent::onBeforeWrite();
 }
开发者ID:helpfulrobot,项目名称:phpboyscout-silverstripe-scouts,代码行数:7,代码来源:ScoutGroup.php

示例6: onBeforeWrite

 /**
  * Overwrites default behaviour onBeforeWrite
  *
  * This method sets the page name based on the selected MovieTitle. If no movie title exists,
  * it will retain the existing page title (and navigation labels).
  * It clears the URL Segment variable as the SiteTree::onBeforeWrite will determine a new url-segment
  * based on the new page tile (which is the movie title).
  */
 protected function onBeforeWrite()
 {
     if ($this->MovieTitle) {
         $this->Title = $this->MovieTitle;
         $this->URLSegment = '';
     }
     parent::onBeforeWrite();
 }
开发者ID:helpfulrobot,项目名称:fb3rasp-moviepages,代码行数:16,代码来源:MoviePage.php

示例7: onBeforeWrite

 public function onBeforeWrite()
 {
     parent::onBeforeWrite();
     $parent = $this->Parent();
     if ($parent && $parent instanceof SummitPage && $parent->SummitID > 0) {
         $this->SummitID = $parent->SummitID;
     }
 }
开发者ID:OpenStackweb,项目名称:openstack-org,代码行数:8,代码来源:SummitPage.php

示例8: onBeforeWrite

 function onBeforeWrite()
 {
     // Move to Photo Gallery Holder if created under something else
     if ($this->Parent()->ClassName != "PhotoGalleryHolder" && PhotoGalleryHolder::get()->count() > 0) {
         $this->ParentID = PhotoGalleryHolder::get()->first()->ID;
     }
     parent::onBeforeWrite();
 }
开发者ID:helpfulrobot,项目名称:purplespider-basic-galleries,代码行数:8,代码来源:PhotoGalleryPage.php

示例9: onBeforeWrite

 public function onBeforeWrite()
 {
     parent::onBeforeWrite();
     // set the filing mode, now that it's being obsolete
     if ($this->AutoFiling && !$this->FilingMode) {
         $this->FilingMode = 'day';
         $this->AutoFiling = false;
     }
 }
开发者ID:nyeholt,项目名称:silverstripe-news,代码行数:9,代码来源:NewsHolder.php

示例10: onBeforeWrite

 /**
  * Set firstWrite flag if this is the first time this Product is written.
  * 
  * @see SiteTree::onBeforeWrite()
  * @see Product::onAfterWrite()
  */
 public function onBeforeWrite()
 {
     parent::onBeforeWrite();
     if (!$this->ID) {
         $this->firstWrite = true;
     }
     //Save in base currency
     $shopConfig = ShopConfig::current_shop_config();
     $this->Currency = $shopConfig->BaseCurrency;
 }
开发者ID:vinstah,项目名称:body,代码行数:16,代码来源:Product.php

示例11: onBeforeWrite

 /**
  * Creates a report template instance if one does not exist.
  */
 protected function onBeforeWrite()
 {
     parent::onBeforeWrite();
     if (!$this->ReportTemplateID && $this->ReportType && ClassInfo::exists($this->ReportType)) {
         $template = Object::create($this->ReportType);
         $template->Title = $this->Title;
         $template->write();
         $this->ReportTemplateID = $template->ID;
     }
 }
开发者ID:helpfulrobot,项目名称:maldicore-advancedreports,代码行数:13,代码来源:ReportPage.php

示例12: onBeforeWrite

 /**
  * When saving, check to see whether we should delete the
  * listing source ID
  */
 public function onBeforeWrite()
 {
     parent::onBeforeWrite();
     if (!$this->ID) {
         $this->Content = '$Listing';
     }
     if ($this->ClearSource) {
         $this->ClearSource = false;
         $this->ListingSourceID = 0;
     }
 }
开发者ID:helpfulrobot,项目名称:silverstripe-listingpage,代码行数:15,代码来源:ListingPage.php

示例13: onBeforeWrite

 /**
  * Make sure Geonetwork url ends with an /.
  */
 function onBeforeWrite()
 {
     parent::onBeforeWrite();
     $geoUrl = $this->GeonetworkBaseURL;
     if (strlen($geoUrl) > 1) {
         $geoUrlLen = strlen($geoUrl) - 1;
         if ($geoUrl[$geoUrlLen] != '/') {
             $this->GeonetworkBaseURL .= '/';
         }
     }
 }
开发者ID:helpfulrobot,项目名称:silverstripe-geocatalogue,代码行数:14,代码来源:RegisterDataPage.php

示例14: onBeforeWrite

 /**
  * The "default" structure used for this report when auto generating etc
  */
 public function onBeforeWrite()
 {
     parent::onBeforeWrite();
     if (!$this->ReportTemplateID && $this->ReportType && ClassInfo::exists($this->ReportType)) {
         $template = Object::create($this->ReportType);
         // create the template first. This is what all actual reports are based on when they're generated, either
         // automatically or by the 'generate' button
         $template->Title = $this->Title . ' Preview';
         $template->write();
         $this->ReportTemplateID = $template->ID;
     }
 }
开发者ID:rodneyway,项目名称:silverstripe-advancedreports,代码行数:15,代码来源:ReportPage.php

示例15: onBeforeWrite

 /** 
  * We have to change it to copy all the content from the original page first.
  */
 function onBeforeWrite()
 {
     // Don't do this stuff when we're publishing
     if (!$this->extension_instances['Versioned']->migratingVersion) {
         if (isset($this->changed['CopyContentFromID']) && $this->changed['CopyContentFromID'] && $this->CopyContentFromID != 0 && $this instanceof VirtualPage) {
             $source = DataObject::get_one("SiteTree", sprintf('`SiteTree`.`ID` = %d', $this->CopyContentFromID));
             $this->copyFrom($source);
             $this->URLSegment = $source->URLSegment . '-' . $this->ID;
         }
     }
     parent::onBeforeWrite();
 }
开发者ID:racontemoi,项目名称:shibuichi,代码行数:15,代码来源:VirtualPage.php


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