Jump to:

10931 Posts in 2614 Topics by 1810 members

All other Modules

SilverStripe Forums » All other Modules » Attempting Agile Carousel Module

Discuss all other Modules here.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 1730 Views
  • theoldlr
    Avatar
    Community Member
    103 Posts

    Attempting Agile Carousel Module Link to this post

    I am attempting to build a module for the agile carousel (www.agilecarousel.com). This is also the first module I will have written for SilverStripe so I hope I'm not biting off more than I can chew. I started off reading the tutorial that guides you through the randomlinks module, but comments and forum posts lead me to believe that some of these methods are outdated.

    I have started to put together classes, and am using ModelAdmin for adding to the CMS (see attached). I'm hoping to gain some understanding of data relationships and using them to make the CMS interface powerful from this thread.

    My basic idea for this was to allow for creating slides in the CMS (for now enter html code with text/image). Allow for creating carousels by assigning a title(i.e. home page carousel), and finally letting the user select which slides are included on each carousel. At the moment I am getting an error when I click the create carousel button. "Fatal error: Call to a member function dataFields() on a non-object in C:\website\cs\sapphire\forms\Form.php on line 821"

    I'm assuming this is because of a bad relationship. Here is my code so far:

    AgileCarouselAdmin.php:

    class AgileCarouselAdmin extends ModelAdmin {

    public static $managed_models = array(
    'Carousel',
    'Slide'
    );
    static $url_segment = 'agilecarousel';
    static $menu_title = 'Agile Carousel';
    }


    Carousel.php:

    <?php
    class Carousel extends DataObject {

    static $db = array (
    'Title' => 'Varchar'
    );

    static $has_many = array(
    'Slides' => 'Slide'
    );

    function getCMSFields_forPopup() {
    $fields = new FieldSet();
    $fields->push( new TextField('Title') );
    return $fields;
    }

    function getCMSfields() {
    $fields = parent::getCMSFields();

    $tablefield = new HasOneComplexTableField (
    $this,
    'Slides',
    'Slide',
    array(
    'Title' => 'Title'
    ),
    'getCMSFields_forPopup'
    );
    }

    }


    Slide.php:

    <?php
    class Slide extends DataObject {
    static $db = array(
    'Title' => 'Varchar',
    'Code' => 'HTMLText'
    );
    }

    Expertise, tutorials, references--any help is really appreciated!

    Attached Files
  • davidm2010
    Avatar
    Community Member
    107 Posts

    Re: Attempting Agile Carousel Module Link to this post

    This is exactly what is needed to improve the looks of a home page. I wish I understood this better, I would help. But it is what is needed. If you get it solved, please post here.

    David

    1730 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.