Jump to:

1842 Posts in 1600 Topics by 558 members

Blog Module

SilverStripe Forums » Blog Module » Use TagField with BlogEntry?

Discuss the Blog Module.

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

Page: 1
Go to End
Author Topic: 843 Views
  • bmc38119
    Avatar
    Community Member
    45 Posts

    Use TagField with BlogEntry? Link to this post

    Is it possible to replace the standard tag field on BlogEntry with the auto-complete TagField?

  • kindlemanwill
    Avatar
    Community Member
    67 Posts

    Re: Use TagField with BlogEntry? Link to this post

    bump.

    This has to be a common requirement. Are there any resources on this?

    Will

  • Juanitou
    Avatar
    Community Member
    323 Posts

    Re: Use TagField with BlogEntry? Link to this post

    Hi Will,

    This is not recommended, but you can replace in BlogEntry the line 81 with:

    if(class_exists('TagField')) {
       $tagfield = new TagField("Tags", _t("BlogEntry.TS", "Tags (comma sep.)"), null, "BlogEntry");
       $tagfield->setSeparator(', ');
       $fields->addFieldToTab("Root.Content.Main", $tagfield, "Content");
    } else {
       $fields->addFieldToTab("Root.Content.Main", new TextField("Tags", _t("BlogEntry.TS", "Tags (comma sep.)")),"Content");
    }

    Hope it helps,
    Juan

  • BuddhaSource
    Avatar
    Community Member
    57 Posts

    Re: Use TagField with BlogEntry? Link to this post

    So this works ?

    Can I put this code in mysite ? I don't want to edit the blog code, its a problem when you upgrade.

  • kindlemanwill
    Avatar
    Community Member
    67 Posts

    Re: Use TagField with BlogEntry? Link to this post

    @buddhaSource - no not in mysite - in the BlogEntry class instead of the regular field.

    I'm not getting good results with it though. seems pretty buggy

    w

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