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.

Customising the CMS /

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

Page list optionfield


Go to End


2 Posts   2648 Views

Avatar
Sec

Community Member, 13 Posts

7 January 2009 at 9:45pm

Hi!

I have the following line:
$fields->addFieldToTab('Root.Content.Main', new OptionsetField('Link', 'Link to page:', DataObject::get('Page'),'URLSegment'));

This list all the pages on my site, only I don't want the list to output the page type (like Page, Article Page, Image Page etc.), but the page URLSegment. How can I get the URLSegment of each page insted where the DataObject::get('Page') is now?

Avatar
Sec

Community Member, 13 Posts

7 January 2009 at 9:56pm

Edited: 07/01/2009 9:56pm

Found the solution. Logically you can do DataObject::get('Page')->column('Title') or DataObject::get('Page')->column('URLSegment') to solve this :)