7913 Posts in 1355 Topics by 930 members
DataObjectManager Module
SilverStripe Forums » DataObjectManager Module » [Solved] Single album redirect no working on subclassed page
Discuss the DataObjectManager module, and the related ImageGallery module.
Moderators: martimiz, UncleCheese, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba, simon_w
|
Page:
1
|
Go to End | |
| Author | Topic: | 537 Views |
-
[Solved] Single album redirect no working on subclassed page

14 July 2010 at 3:38am Last edited: 15 July 2010 1:54pm
I've sub-classed ImageGalleryPage so that I can add new field to allow user to specify which album is used to provide a cover image at a higher level (i have many galleries at top level), and I've changed my gallery pages to use MyGalleryPage...
<?php
class MyImageGalleryPage extends ImageGalleryPage
{static $hide_ancestor = true;
static $db = array (
'CoverAlbum' => "Varchar(255)"
);public function getCMSFields($cms) {
$f = parent::getCMSFields($cms);$f->addFieldToTab("Root.Content.Configuration", new TextField('CoverAlbum', 'Album to use for gallery cover image'));
return $f;
}
}class MyImageGalleryPage_Controller extends ImageGalleryPage_Controller
{public static $allowed_actions = array (
);
public function init()
{
parent::init();
}
}
?>All works fine except that where a gallery only has one album the redirect directly to that album is not working. I'm presuming this is handled by this code in ImageGalleryPage
public function index()
{
if($this->SingleAlbumView())
return $this->renderWith(array($this->getModelClass().'_album','Page'));
return $this->renderWith(array('ImageGalleryPage','Page'));
}Why is this not working still in my sub-classed version?
-
Re: [Solved] Single album redirect no working on subclassed page

15 July 2010 at 3:20am
Anyone help with this? I'm sure as always it's something obvious I've missed
-
Re: [Solved] Single album redirect no working on subclassed page

15 July 2010 at 11:51am
First, please be more specific. What does "not working" mean?
Have you created the template MyImageGalleryPage_album.ss?
-
Re: [Solved] Single album redirect no working on subclassed page

15 July 2010 at 1:54pm
Bleh
Kept overlooking the line
return $this->renderWith(array($this->getModelClass().'_album','Page'));
as I had it in my head it was using the ModelClass name from the original class not the subclassed version
Thanks Cheese
| 537 Views | ||
|
Page:
1
|
Go to Top |

