How to add new tab in the assets panel

Vote:
 

Hi. I have created a gadget that I want to appear as a new tab in the assets panel beside the Blocks and Media tabs

For a simple test I testet the example from this url: docs.developers.optimizely.com/content-management-system/v11.0.0-cms/docs/creating-a-component-1

public class PlugInArea
{
    public const string Assets = "/episerver/cms/assets";

    public const string AssetsDefaultGroup = "/episerver/cms/assets/defaultgroup";

    public const string NavigationDefaultGroup = "/episerver/cms/mainnavigation/defaultgroup";

    public const string Navigation = "/episerver/cms/mainnavigation";

    protected PlugInArea()
    {
    }
}
But my gadget is always placed below the assets area.
How can the widget be plased as a new tab after the Media tab?
#329818
Sep 13, 2024 8:18
Vote:
 

Hi,

I think there is a setting named SortOrder. Just try to set suitable value for SortOrder to display in the order that you want.

#330065
Edited, Sep 16, 2024 12:48
Vote:
 

Looking at the CMS 12 docs -- https://docs.developers.optimizely.com/content-management-system/docs/plugging-in-a-gadget

Are you using PlugInArea == "AssetsPanel"?

#330067
Sep 16, 2024 13:50
Vote:
 

Did you try to set SortOrder and PlugInAreas as following:

[Component]
public class CustomComponent : ComponentDefinitionBase
{	
	public CustomComponent ()
		: base([yourWidgetType])
	{
                //...
		base.SortOrder = 200;
		base.PlugInAreas = new string[1] { PlugInArea.AssetsDefaultGroup };		
                //...
	}
}
#330111
Sep 17, 2024 3:13
Vote:
 

Hm.

I have testet all different values for the SordOrder and the PluginAreas.

Sometimes when I compile when I use PlugInAreas = ["AssetsPanel"]; It is added as expected, but with next compile it is separated again.

My component:

```

[Component]
public class VoiceSubscriptionContentPaneNavigationComponent : ComponentDefinitionBase
{
    public VoiceSubscriptionContentPaneNavigationComponent() : base("epi-cms/component/SharedBlocks")
    {
        SortOrder = 200;
        PlugInAreas = ["AssetsPanel"];
        Categories = ["cms"];
        Title = "Abonnementer";
        Settings.Add(new Setting("repositoryKey", Constants.RepositorySettings.VoiceSubscriptionContentRepositoryKey));
    }
}

```

#330391
Sep 23, 2024 10:12
Vote:
 

Hi, when you use PlugInArea, you need to sort it.

I did it for settings

public class PlugInArea
{
    public const string Assets = "/episerver/cms/assets";
    public const string AssetsDefaultGroup = "/episerver/cms/assets/defaultgroup";
    public const string NavigationDefaultGroup = "/episerver/cms/mainnavigation/defaultgroup";
    public const string Navigation = "/episerver/cms/mainnavigation";

    protected PlugInArea();
}

then call your plugin 

 [Component]
 public sealed class GlobalSettingsComponent : ComponentDefinitionBase
 {
     public GlobalSettingsComponent()
         : base("epi-cms/component/MainNavigationComponent")
     {
         LanguagePath = "/episerver/cms/components/globalsettings";
         Title = "Site settings";
         SortOrder = 1000;
         PlugInAreas = new[] { PlugInArea.AssetsDefaultGroup };
         Settings.Add(new Setting("repositoryKey", value: GlobalSettingsRepositoryDescriptor.RepositoryKey));
     }
 }
#330884
Oct 03, 2024 14:57
Vote:
 

Thanks for all help! 

After trying a lot it was the code 

```

SortOrder = 11000;
PlugInAreas = PlugInAreas = new[] { PlugInArea.AssetsDefaultGroup };

```

And reset view that fixed the issue. I don't know why I need to add so big sortorder.

#330942
Oct 04, 2024 11:30
Vote:
 
Occasionally you will encounter this again, whenever you move your code around and switch between multiple environment database backups, you will see your tab is missing again, you will have to "Reset views" to bring the tab back again.
#332241
Oct 31, 2024 21:00
* 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.