Settings_Submodule_Interface

Interface for a submodule that supports settings.

Description

Source

File: src/modules/settings-submodule-interface.php

interface Settings_Submodule_Interface {

	/**
	 * Retrieves the value of a specific submodule option.
	 *
	 * @since 1.0.0
	 *
	 * @param string $option  Name of the option to retrieve.
	 * @param mixed  $default Optional. Value to return if the option doesn't exist. Default false.
	 * @return mixed Value set for the option.
	 */
	public function get_option( $option, $default = false );

	/**
	 * Retrieves the values for all submodule options.
	 *
	 * @since 1.0.0
	 *
	 * @return array Associative array of `$key => $value` pairs for every option that is set.
	 */
	public function get_options();

	/**
	 * Returns the settings identifier for the submodule.
	 *
	 * @since 1.0.0
	 *
	 * @return string Submodule settings identifier.
	 */
	public function get_settings_identifier();

	/**
	 * Returns the settings subtab title for the submodule.
	 *
	 * @since 1.0.0
	 *
	 * @return string Submodule settings title.
	 */
	public function get_settings_title();

	/**
	 * Returns the available settings sections for the submodule.
	 *
	 * @since 1.0.0
	 *
	 * @return array Associative array of `$section_slug => $section_args` pairs.
	 */
	public function get_settings_sections();

	/**
	 * Returns the available settings fields for the submodule.
	 *
	 * @since 1.0.0
	 *
	 * @return array Associative array of `$field_slug => $field_args` pairs.
	 */
	public function get_settings_fields();
}

Changelog

Changelog
Version Description
1.0.0 Introduced.

Methods

  • enabled — Checks whether the protector is enabled for a specific form.
  • get_meta_fields — Returns the available meta fields for the submodule.
  • render_output — Renders the output for the protector before the Submit button.
  • verify_request — Verifies a request by ensuring that it is not spammy.
  • wrap_form_name — Wraps a non-prefixed form input name attribute so that it will be properly included the submission POST data.