Skip to main content

Version Docs Updated

Purpose

This page explains how Rentiva's "Additional Services" (Add-ons) settings are configured in the admin panel, and describes the technical architecture of the AddonSettings class.

πŸ› οΈ AddonSettings Class

AddonSettings is a settings group built on top of the WP Settings API that manages the global behavior of add-ons.


πŸ—οΈ Architecture​

The class integrates with SettingsCore and SettingsHelper using a modular structure:

  • Namespace: MHMRentiva\Admin\Settings\Groups
  • Methods: Registration (register), default value definition (get_default_settings), and access (require_confirmation) are all handled through static methods.

πŸ“ Registration and Field Definitions​

The register() method adds a new section and settings fields to WordPress:

public static function register(): void {
$page_slug = SettingsCore::PAGE;

add_settings_section(
self::SECTION_ID,
__( 'Additional Services Settings', 'mhm-rentiva' ),
array( self::class, 'render_section_description' ),
$page_slug
);

// Field registration via SettingsHelper
SettingsHelper::checkbox_field($page_slug, 'mhm_rentiva_addon_require_confirmation', ...);
SettingsHelper::select_field($page_slug, 'mhm_rentiva_addon_display_order', ...);
}

πŸ“‹ Available Settings Fields​

Option KeyUI TypeDefaultDescription
require_confirmationCheckbox0 (False)Whether manual confirmation is required for add-ons.
show_prices_in_calendarCheckbox1 (True)Whether add-on prices are shown in the calendar.
display_orderSelectmenu_orderSorting criterion for add-ons (Title, Price, Date).

πŸ›‘οΈ Data Access (Static Accessors)​

Developers should use the type-safe accessor methods instead of raw get_option:

// Check confirmation requirement
if ( AddonSettings::require_confirmation() ) {
// Logic
}

Section Summary​

  • AddonSettings is a modernization layer on top of the WP Settings API.
  • All settings are fetched atomically via SettingsCore::get().
  • For visual design references, see assets under /website/static/img/docs/ui-components/.

Changelog​

DateVersionNote
23.04.20264.27.2English translation added.
19.03.20264.21.2Page updated to reflect modern SettingsHelper and modularity structure.