Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Blog Module /

Discuss the Blog Module.

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

Use TagField with BlogEntry?


Go to End


5 Posts   1768 Views

Avatar
bmc38119

Community Member, 45 Posts

4 January 2011 at 10:43am

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

Avatar
kindleman.com.au

Community Member, 70 Posts

14 October 2011 at 7:06pm

bump.

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

Will

Avatar
Juanitou

Community Member, 323 Posts

14 October 2011 at 10:28pm

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

Avatar
BuddhaSource

Community Member, 57 Posts

17 October 2011 at 4:05pm

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.

Avatar
kindleman.com.au

Community Member, 70 Posts

3 November 2011 at 6:21pm

@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