Jump to:

23486 Posts in 18995 Topics by 2878 members

General Questions

SilverStripe Forums » General Questions » Error When Accessing Admin

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Page: 1
Go to End
Author Topic: 809 Views
  • MagicUK
    Avatar
    Community Member
    60 Posts

    Error When Accessing Admin Link to this post

    When Accessing Admin I get the following error when in DEV mode:

    [Warning] Missing argument 2 for LabelField::__construct(), called in /home/m8lighti/public_html/mysite/code/PageInt.php on line 22 and defined

    10 class LabelField extends DatalessField {
    11    
    12    /**
    13     * @param string $name
    14     * @param string $title
    15     * @param string $className (Deprecated: use addExtraClass())
    16     * @param bool $allowHTML (Deprecated: use setAllowHTML())
    17     * @param Form $form
    18     */
    19    function __construct($name, $title, $className = null, $allowHTML = false, $form = null) {
    20       // legacy handling for old parameters: $title, $heading, ...
    21       // instead of new handling: $name, $title, $heading, ...
    22       $args = func_get_args();
    23       if(!isset($args[1])) {
    24          $title = (isset($args[0])) ? $args[0] : null;
    25          $name = $title;

    The code in my PageInt.php file as per the error is:

    class PageInt extends Page {
    static $db = array(
          'contentBlurb' => 'HTMLText',
       'Right' => 'HTMLText',
    );

    static $has_one = array(
          'IntslideImageOne' => 'Image',
          'IntslideImageTwo' => 'Image',
          'IntslideImageThree' => 'Image',
    );

    function getCMSFields() {
    $fields = parent::getCMSFields();
    $fields->addFieldToTab("Root.Content.Main", new HtmlEditorField('contentBlurb', 'Interior Blurb'));
    $fields->addFieldToTab("Root.Content.Main", new HtmlEditorField('Right', 'Right Content'));
    $fields->addFieldToTab("Root.Content.Images", new LabelField("XXX")); <--- Line 22
       $fields->addFieldToTab("Root.Content.Images", new ImageField('IntslideImageOne'));
       $fields->addFieldToTab("Root.Content.Images", new ImageField('IntslideImageTwo'));
       $fields->addFieldToTab("Root.Content.Images", new ImageField('IntslideImageThree'));
       
    return $fields;
    }

    }

    Any help would be appreciated here. Thanks.

    Mario

  • swaiba
    Avatar
    Forum Moderator
    1792 Posts

    Re: Error When Accessing Admin Link to this post

    well looking at the documentation http://api.silverstripe.org/2.4/forms/fields-dataless/LabelField.html it does seem that it wants two areguments, one to name the field the other for a title. Have you tried passing a second value?

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