RMC Pro Actions API

Below is a list of actions available for you to tap into to create add-ons and modify the behaviour of RMC Pro.

Admin Actions

There are two main areas that Admin Actions allow you to modify. The larger actions allow you to add new RMC Pro menu items, settings tabs, support tabs. Use this for full add-ons that need their own interface, global settings, and help pages.

You can modify the Edit Calculator interface using the finer actions. This allows you to create new sections, elements, settings, and tags.

Add a Sub-Menu Item

rmcp_add_submenu_pages

Add your own menu item to the RMC Pro menu.

Add a Settings Tabs Page

rmcp_add_settings_tabs

Add your own settings tab to the RMC Pro > Settings page.

Add a Support Tab Page

rmcp_add_support_tabs

Add your own support tab to the RMC Pro > Support page.

Add a New Calculator Section

rmcp_add_sections

Create a new section in the calculator editing area of the Edit Calculator interface. New sections will be added after the existing sections (Interface, Processors, Sub-Calculations, Calculators).

Add a New Calculator Element

rmcp_add_elements

Add a new element to any section of the Edit Calculator interface, including new, custom sections you have added.

Add a New Section to a Calculator Element

rmcp_add_element_sections

Add a section to calculator element to group related settings.

Add a New Setting to a Calculator Element

rmcp_add_element_settings

Add a setting to a section in a calculator element.

Add a New Setting to a Calculator Section

rmcp_add_section_settings

Add a setting directly to a section of the calculator, without attaching it to a specific element.

Add a New Tag Section

rmcp_add_tag_sections

Add Calculator Tags

rmcp_add_tag_callbacks

Front End Actions

Modify the behaviour of calculators by adding new processors and user interface elements. In order for the calculator to function properly, processors need to be built in JavaScript with a PHP fallback.

Add a New Feature Once RMC Pro is Ready

rmcp_init

Enqueue Supporting Scripts and JavaScript Processors

rmcp_enqueue_scripts

Add a New PHP Processor

rmcp_add_processors

Registers a processor callback for the interface, processors, calculators, or sub-calculations. The is the PHP fallback processor for the no JavaScript use case.

// Create the callback function to register your processor
function [your_prefix]_register_processor() {
    // Set the processor to run as an 'input', 'primary' processor (Processors and Calculators), 'secondary' (Sub-Calculations), or on 'output'
    $timing         = 'input';
    $section_slug   = 'interface'; // Or other processor section name
    $processor_slug = '[your_processor_name]';
    $callback       = '[your_callback_name]';
    // Add a new processor
    rmcp_add_processor( $timing, $section_slug, $processor_slug, $callback );
}
// Add the action to register the processor
add_action( 'rmcp_add_processors', '[your_prefix]_register_processor' );

// Create the processor function
function [your_processor_name]( $arg1, $arg2, ... ) {
    // ... Process and validate data ... //
    return [your_result];
}
    

A JavaScript processor must also be loaded on the rmcp_enqueue_scripts action and registered on the rmcp object.

rmcp.registerProcessor(
    '[your_element_id]',
    '[existing_section_id]',
    function( arg1, arg2, ... ) {
        // ... Your custom process ... //
        return [your_result];
    },
    // Is an input?
    true // or false
);
    

Add a New UI Element

rmcp_add_ui_elements

Front End & Admin

So far, there is only one action that effects front and admin sections…

Add a Preset Calculator

rmcp_add_presets