Developer Docs - Obsidian - Implementing IHasCustomActions

Overview

If your block needs special configuration settings (similar to the webforms RockBlockCustomSettings class use to provide), you'll want to implement the IHasCustomActions interface and create a separate .obs file to handle displaying the configuration screen. 

Implement a IHasCustomActions.GetCustomActions(...) method similar to this straightforward example, replacing the ComponentFileUrl with the location of your custom .obs template:

#region IHasCustomAdministrateActions

/// 
List IHasCustomActions.GetCustomActions( bool canEdit, bool canAdministrate )
{
    var actions = new List();

    if ( canAdministrate )
    {
        actions.Add( new BlockCustomActionBag
        {
            IconCssClass = "ti ti-edit",
            Tooltip = "Settings",
            ComponentFileUrl = "/Obsidian/Blocks/CMS/contentCollectionViewCustomSettings.obs"
        } );
    }

    return actions;
}

#endregion

You'll also want the block actions for GetCustomSettings() and SaveCustomSettings(...) as seen here:

/// 
/// Gets the values and all other required details that will be needed
/// to display the custom settings modal.
/// 
/// A box that contains the custom settings values and additional data.
[BlockAction]
public BlockActionResult GetCustomSettings()
{
    ...
}

/// 
/// Saves the updates to the custom setting values for this block.
/// 
/// The box that contains the setting values.
/// A response that indicates if the save was successful or not.
[BlockAction]
public BlockActionResult SaveCustomSettings( CustomSettingsBox box )
{
    ...
}