Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » Rendering modules and widgets...

Our old forums are still available as a read-only archive.

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

Page: 1 2
Go to End
Author Topic: 5037 Views
  • Sean
    Avatar
    Forum Moderator
    921 Posts

    Re: Rendering modules and widgets... Link to this post

    One other question: with your blog module at the moment there are Widget, WidgetArea and WidgetAreaEditor classes inside there, along with it's associated templates.

    Are you just putting them into the blog code for now, so later on they will be placed back into the core? It all looks good and fine to me the way you've done it. Looks rather simple in fact.

    By the looks of it, I just made myself 'CoolWidget.php', dropped it into the code with some default $title and $description variables - and had myself a widget that popped up into the Widgets tab on the BlogHolder class. Fantastic!

    Another question:

    BlogHolder.php (line 19):
    $fields->addFieldToTab("Root.Content.Widgets", new WidgetAreaEditor("SideBar"));

    Is there not a way to automatically have these widgets included on all pages, so we don't have to create a new field to apply widgets to (on a class-by-class basis)? I guess you're always going to need a place to tell it where to apply the widgets to, for this example you're rendering into $SideBar for all the widgets, I take it? Is it possible to abstract this even more, or is it best we just let the site developer apply this field to whether they deem appropriate?

    Great work Jeremy and Andy!

    Cheers,
    Sean

  • Sean
    Avatar
    Forum Moderator
    921 Posts

    Re: Rendering modules and widgets... Link to this post

    Actually, now that I see it the code Andy made for dollar variables would work well enough for now.

    Having it more abstracted to call a widget anywhere is something we can do in the future.

    Great work guys!

    Sean

  • laktek
    Avatar
    Google Summer of Code Hacker
    76 Posts

    Re: Rendering modules and widgets... Link to this post

    Are the widget functions only usable with blog module ?

    Curious to test the integration of mashups with widgets...

  • Sean
    Avatar
    Forum Moderator
    921 Posts

    Re: Rendering modules and widgets... Link to this post

    During our testing at the moment they are, but we're working to make this widget interface something everyone can use. We'll let you know when it's released.


    Sean

  • laktek
    Avatar
    Google Summer of Code Hacker
    76 Posts

    Re: Rendering modules and widgets... Link to this post

    I was able to play around with the Widget code on the trunk and it works great! Love the simplicity of the implementation.

    I think making widgets available from SiteTree, along with a global widget area editor would be nice.

  • laktek
    Avatar
    Google Summer of Code Hacker
    76 Posts

    Re: Rendering modules and widgets... Link to this post

    I know widget editor area is still brewing, so thought of sharing few suggestions to make it more sexy ;)

    1. Widget Drag and Drop - Its better to highlight the drop target and create a new instance of drag object while keeping the original object intact. Look at this demo at mootools (http://demos.mootools.net/DragDrop).

    2. Ability to configure each widget - I think this is essential. Users should be able to add configuration information using a simple configuration dialog. For example he should be able to configure FlickrWidget with tags, number of photos to show etc.

  • Andy
    Avatar
    230 Posts

    Re: Rendering modules and widgets... Link to this post

    The widgets are configurable - I've emailed you the FlickWidget I created based on the mashups code as an example.

  • laktek
    Avatar
    Google Summer of Code Hacker
    76 Posts

    Re: Rendering modules and widgets... Link to this post

    Thanks for the sample.

    I was playing with the widgets on a custom theme and I found having a "container div" around the widget would be make styling much easier.

    This could be done by changing WidgetHolder.ss to :
    [html]
    <div class="widgetHolder">
    <h3>$Title</h3>
    $Content
    </div>
    [/html]
    Another option is to make the widget area as an unordered list.

    5037 Views
Page: 1 2
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.