5102 Posts in 1520 Topics by 1116 members
| Go to End | Next > | |
| Author | Topic: | 2261 Views |
-
move Title field from Meta-data to Main?

10 March 2009 at 7:39am
Hello,
Is there a way to have textfield for Title from Content -> Meta-data appear under the Content -> Main tab instead?
Thank you!
J.
-
Re: move Title field from Meta-data to Main?

10 March 2009 at 2:30pm
Hi,
I guess that would be:
function getCMSFields() {
$fields = parent::getCMSFields();
$fields->removeFieldFromTab("Root.Content.Main","MetaTitle");
$fields->addFieldToTab("Root.Content.Main", new TextField("MetaTitle", "Title"), "Content");
return $fields;
}The "Content" is to place the Title field before the Content field, otherwise it would appear at the bottom.
Cheers!
Anatol -
Re: move Title field from Meta-data to Main?

29 May 2009 at 8:30pm
For people new to SilverStripe like me, the code should be added to \mysite\code\Page.php
class Page extends SiteTree {
public static $db = array(
);public static $has_one = array(
);/** Add code here **/
function getCMSFields() {
$fields = parent::getCMSFields();
$fields->removeFieldFromTab("Root.Content.Main","MetaTitle");
$fields->addFieldToTab("Root.Content.Main", new TextField("MetaTitle", "Title"), "Content");
return $fields;
}
}After adding the code flush the DB ( http://localhost/dev/build?flush=1 )
-
Re: move Title field from Meta-data to Main?

31 October 2009 at 7:27pm
The Title shows up fine, but it is not at the top. Any ideas how to get it to the top?
-
Re: move Title field from Meta-data to Main?

31 October 2009 at 7:31pm
Now I like it at the bottom because it is blank to begin with. Once the Page name is given it is filled in. Good to go!
-
Re: move Title field from Meta-data to Main?

31 October 2009 at 8:58pm
In case you change your mind and want it at the top again, you can use the third parameter of addFieldToTab to determine the position. See http://api.silverstripe.org/forms/fields-structural/FieldSet.html#addFieldToTab
-
Re: move Title field from Meta-data to Main?

1 November 2009 at 3:24am
Thank you for the info. Where can I find the complete docs like this?
| 2261 Views | ||
| Go to Top | Next > |



