Friday, 15 June 2012

silverstripe - decluttering UI, order Extension gets applied -


Some years ago I created a SilverStripe website and added several fields to Page.php. I am currently working on something like this but can not afford to change the project again - now at Silverstream 3.1.10

I have to announce the UI for the page sub-classes , Which does not need all the hereditary areas with some extensions.

How this extension can appear

>
  class nocturnal extensions {public function update cmsfield (fieldlist $ field) {$ fields- & gt; Extends removeFieldFromTab ("Root.Main", "MenuTitle"); $ Fields- & gt; RemoveFieldFromTab ("Root.Main", "workflow"); }}  

config.yml

  Redirector page: Extension: - NOKLATOR  

For all fields of this field Works on SiteTree (like Manititel field), but not in the field added to page (such as Workflow fields) If the extension is on UserDefinedForm , the workflow has been removed but if this extension is on the redirect page , So this does not work on the other side MenuTitle is removed in both classes. My guess is this sequence is about my project after : 'frame /', 'cm /' and hopefully i like a noclutter work within the project Can I create an extension

How can I get it or how do I work around this problem?

You have to $ this-> At the end of your page getCMSFields () function ('updateCMSFields', $ fields) need to be expanded.

increases category page citrate {// ... public function getCMSFields () {// call update CMSfield after adding your field to SiteTree :: disableCMSFieldsExtensions (); $ Fields = parent :: getCMSFields (); SiteTree :: enableCMSFieldsExtensions (); // ... $ this- & gt; Expand ('updateCSMSFields', $ fields); Return $ field; }}

$ this-> expand ('updateCMSFields', $ fields) declares your code where updateCSMSFields () The function will be called page getCMSFields ()

The problem you have is updateCMSFields () You are trying to delete the workflow field before you add it to the page code> function. The reason for this is that the UpdateCMSFields extension hook is declared in the original SiteTree getCMSFields () function.

UserDefinedForm it resolves $ this- & gt; Call it under the getCMSFields () ('updateCMSFields', $ field) . An extension hook is said to work to parent :: getCMSFields () before SiteTree :: disableCMSFieldsExtensions () .


No comments:

Post a Comment