Try our conversational search powered by Generative AI!

Edit Panel plugin for a specific PageTypeID

Vote:
 
Hello, We need to create a plugin for the edit panel that will simplify input of certain page property values. However, this plugin should only be used for a certain page type. Is it possible to restrict this plugin so that the tab/plugin is only available on one or more pagetypes? Is it possible to show/hide both the tab and user control from codebehind depending on CurrentPage.PageTypeID? Thanks / Christoffer
#12957
Mar 08, 2007 15:27
Vote:
 
See the SDK, Class Library, EPiServer.PlugIn, Interfaces and the help for the ICustomPlugInLoader interface. The example code shows how to restrict the plug-in for a user role. But you can just as easily do this for a page type too. Just use CurrentPage as you would on a template, it will be populated with the currently loaded page in Edit mode. Can't be easier than that :-) This is a more advanced example showing how to restrict loading to only configured page types: http://www.coderesort.com/projects/epicode/browser/BVNetwork.SendMail/branches/v2/BVNetwork.EPiSendMail/bvn/SendMail/Plugin/SendPageAsMail.ascx.cs /Steve
#15153
Mar 08, 2007 17:49
Vote:
 
Thanks! It work fine to add the user control and it was very easy to implement the ICustomPluginLoader interface. However, I noticed a very strange behaviour when using the control in this way. It seems like it's (for some reason) is impossible to get the value of inherited dynamic properties from CurrentPage when using the usercontrol in this way. (CurrentPage["DynProp"]==null) returns true when in edit-mode and false when exactly the same control is used on a page. I also tried this which makes even less sense. PageData pd = Global.EPDataFactory.GetPage(CurrentPage.PageLink); Response.Write(pd["DynProp"]==null); This prints true when used in edit-mode and false when used on an ordinary page. Is this a bug in EPiServer or is there any reasonable explanation for this? Unfortunatley, my user control that I want to use as a edit-mode plugin needs to read the value of the dynamic property on that page. Regards, Christoffer
#15154
Mar 09, 2007 10:26
Vote:
 
A PageData object can be populated in 2 ways, with all properties (both page and dynamic) and without dynamic properties. When on the editpanel the PageData object you get with CurrentPage is probably fetched without dynamic properties because only page properties is to be handled in that context. So use GetPage with CurrentPageLink instead of CurrentPage if you need to fetch dynamic properties. Or depending on your needs you could use load on the DynamicProperty class to fetch only one dynamic property. Regards, HAXEN
#15155
Mar 16, 2007 9:38
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.