original_string: public function renderPreview() {
          $previewFieldMap=array(
                                  'ClassName'=>$this->DestinationClass,
                                  'IsKapostPreview'=>true,
                                  'Children'=>false,
                                  'Menu'=>false,
                                  'MetaTags'=>false,
                                  'Breadcrumbs'=>false,
                                  'current_stage'=>Versioned::current_stage(),
                                  'SilverStripeNavigator'=>false
                              );
          
          //Allow extensions to add onto the array
          $extensions=$this->extend('updatePreviewFieldMap');
          $extensions=array_filter($extensions, function($v) {return !is_null($v) && is_array($v);});
          if(count($extensions)>0) {
              foreach($extensions as $ext) {
                  $previewFieldMap=array_merge($previewFieldMap, $ext);
              }
          }
          
          
          //Find the controller class
          $ancestry=ClassInfo::ancestry($this->DestinationClass);
          while($class=array_pop($ancestry)) {
              if(class_exists($class."_Controller")) {
                  break;
              }
          }
          
          $controller=($class!==null ? "{$class}_Controller":"ContentController");
          
          return $controller::create($this)->customise($previewFieldMap);
      }
code: public function renderPreview() {
          $previewFieldMap=array(
                                  'ClassName'=>$this->DestinationClass,
                                  'IsKapostPreview'=>true,
                                  'Children'=>false,
                                  'Menu'=>false,
                                  'MetaTags'=>false,
                                  'Breadcrumbs'=>false,
                                  'current_stage'=>Versioned::current_stage(),
                                  'SilverStripeNavigator'=>false
                              );
          
          //Allow extensions to add onto the array
          $extensions=$this->extend('updatePreviewFieldMap');
          $extensions=array_filter($extensions, function($v) {return !is_null($v) && is_array($v);});
          if(count($extensions)>0) {
              foreach($extensions as $ext) {
                  $previewFieldMap=array_merge($previewFieldMap, $ext);
              }
          }
          
          
          //Find the controller class
          $ancestry=ClassInfo::ancestry($this->DestinationClass);
          while($class=array_pop($ancestry)) {
              if(class_exists($class."_Controller")) {
                  break;
              }
          }
          
          $controller=($class!==null ? "{$class}_Controller":"ContentController");
          
          return $controller::create($this)->customise($previewFieldMap);
      }
code_tokens: public function renderPreview ( ) { $ previewFieldMap = array ( 'ClassName' => $ this -> DestinationClass , 'IsKapostPreview' => true , 'Children' => false , 'Menu' => false , 'MetaTags' => false , 'Breadcrumbs' => false , 'current_stage' => Versioned :: current_stage ( ) , 'SilverStripeNavigator' => false ) ; //Allow extensions to add onto the array $ extensions = $ this -> extend ( 'updatePreviewFieldMap' ) ; $ extensions = array_filter ( $ extensions , function ( $ v ) { return ! is_null ( $ v ) && is_array ( $ v ) ; } ) ; if ( count ( $ extensions ) > 0 ) { foreach ( $ extensions as $ ext ) { $ previewFieldMap = array_merge ( $ previewFieldMap , $ ext ) ; } } //Find the controller class $ ancestry = ClassInfo :: ancestry ( $ this -> DestinationClass ) ; while ( $ class = array_pop ( $ ancestry ) ) { if ( class_exists ( $ class . "_Controller" ) ) { break ; } } $ controller = ( $ class !== null ? "{$class}_Controller" : "ContentController" ) ; return $ controller :: create ( $ this ) -> customise ( $ previewFieldMap ) ; }
docstring: Handles rendering of the preview for this object
  @return string Preview to be rendered
docstring_tokens: Handles rendering of the preview for this object