Jump to:

794 Posts in 409 Topics by 304 members

Widgets

SilverStripe Forums » Widgets » single content widget depreciated: SOLVED

Discuss SilverStripe Widgets.

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

Page: 1
Go to End
Author Topic: 851 Views
  • w1l
    Avatar
    Community Member
    13 Posts

    single content widget depreciated: SOLVED Link to this post

    Hi Guys

    I get this error (growl) when trying to open a page with this widget running (SS3.0.2)

    Notice at line 168 of /nfs/c03/h01/mnt/81833/domains/youthguarantee.net.nz/html/framework/dev/Deprecation.php

    Does anyone know how to fix this? My guess is theres something wrong in the php file:

    <?php
    /**
    * Widget to display a single Page Content
    * @package widgets.singlecontent
    * @author Rui Godinho
    */
    class SingleContentWidget extends Widget {
       static $title = '';
       static $cmsTitle = 'Single Content';
       static $description = 'Adds content from a child page to the widget sidebar.';
       
       static $db = array(
          'WidgetTitle' => 'Varchar(255)',
          'SinglePage'=>'Varchar(255)'
          );
       static $defaults = array(
          'SinglePage'=>'home'
          );
       
       function Title() {
          return $this->WidgetTitle ? $this->WidgetTitle : self::$title;
       }

       function getCMSFields() {
          // TODO: Usar TreeDropdownField when bug fixed
          return new FieldSet(
             new TextField('WidgetTitle', _t('TITLE','Title (optional)')),
             new TextField('SinglePage', _t('SINGLEPAGE', 'The URL segment of the page to display.'))
          );
       }
       
       /**
        * Return a Single Content Page
        * @return DataObject
        */
       function SingleContent() {
          $page = DataObject::get_one('SiteTree', "URLSegment = '". Convert::raw2sql($this->SinglePage) . "'");
          if(!$page) {
             return false;
          }
          else {
             return $page;
          }
       }
    }

    thanks all.
    /w

  • w1l
    Avatar
    Community Member
    13 Posts

    Re: single content widget depreciated: SOLVED Link to this post

    2 things to add to this:

    1) The widgets works ok on my local site (MAMP) which uses PHP5.3.6
    2) The hosting server is using PHP5.3.15

    I see that Silverstripe says the min requirements to run is PHP5.3.2 - could this be the problem i wonder?

  • w1l
    Avatar
    Community Member
    13 Posts

    Re: single content widget depreciated: SOLVED Link to this post

    OK so its not the PHP ... I've now deployed to server running PHP5.3.3.7 and the problem persists.

    /w

  • simon_w
    Avatar
    Forum Moderator
    473 Posts

    Re: single content widget depreciated: SOLVED Link to this post

    The error message will tell you that FieldSet is deprecated and you should use FieldList instead (in your getCMSFields() methods). This will only show when using a site in dev mode and with your php.ini settings display_errors to On.

  • w1l
    Avatar
    Community Member
    13 Posts

    Re: single content widget depreciated: SOLVED Link to this post

    OK so the problem was fixed in the end buy taking out a bunch of customisations in the _config file, not by changing the Content widget at all.

    The config file is now stripped right back to the original fresh instal version and all seems OK.

    Thanks for the info on dev mode though Simon, goona need to employ that now re my next problem (http://www.silverstripe.org/general-questions/show/21727#post318797)

    Cheers
    Wil

    851 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.