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

Move URL field to Main tab


Go to End


6 Posts   3010 Views

Avatar
bmc38119

Community Member, 45 Posts

7 February 2010 at 5:29am

Has anyone had any luck moving the URL field to the Main tab? I tried it about a month ago with no luck. i am pretty familiar with customizing the CMS tabs in the past, but cannot seem to get this particular field to move correctly. any tips would be appreciated.

Avatar
MateuszU

Community Member, 89 Posts

8 February 2010 at 9:15am

What about something like below? I didn't try that, this is based on code that moves tabs around, so it might fail :)

$segment = $fields->fieldByName('Root')->fieldByName('Content')->fieldByName('Metadata')->fieldByName('URLSegment');
$fields->removeFieldFromTab('Root.Content.Metadata', 'URLSegment');
$fields->addFieldToTab('Root.Content.Main', $segment);

mat.

Avatar
bmc38119

Community Member, 45 Posts

10 February 2010 at 11:02am

thanks for idea - but this method did not work. anyone else have any insight/experience with moving this Field to the Main tab?

Avatar
DeklinKelly

Community Member, 197 Posts

2 April 2010 at 1:58pm

This works for me:

      $fields->removeFieldFromTab('Root.Content.Metadata', 'URL'); 
      $fields->addFieldToTab("Root.Content.Main", new TextField('URLSegment','URL'));

Avatar
Deklin

Community Member, 16 Posts

12 July 2010 at 2:02pm

I tried the code posted by hknight and it moves the URL to the main tab however the field is no longer automatically filled by JavaScript. How can I get the JavaScript to auto-fill it after moving it?

Avatar
TotalNet

Community Member, 181 Posts

12 July 2010 at 3:00pm

You might need to update the script, it uses the id of the input element which may have changed after you moved it.

The script is sapphire/javascript/UpdateURL.js

either edit it or better still, block the requirement and add your own updated version of the script (in your getCMSFields).

This is based on v2.4.0.

hth