Created
July 19, 2023 09:37
-
-
Save sergeliatko/f7012a6fd36480cb2779e4cd98cb96d8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* THIS IS AN EXAMPLE OF USAGE TAKEN AND MODIFIED FROM AN EXISTING PLUGIN | |
* ----- DO NOT USE THE CODE AS IS WITHOUT THINKING AND UNDERSTANDING WHAT IT DOES ----- | |
* | |
* COMMENTS ARE ADDED TO HELP UNDERSTANDING THE APPROACH USED IN THE PLUGIN AND HOW TO WORK WITH WPSETTINGS | |
*/ | |
namespace TechSpokes\TrackHospitalitySoftware; | |
use SergeLiatko\HTML\Span; # external dependency - html formatting class | |
use SergeLiatko\WPSettings\Setting; # WPSettings external dependency | |
use SergeLiatko\WPSettings\UI; # WPSettings external dependency | |
use TechSpokes\TrackHospitalitySoftware\Analytics\DataLayer; # internal dependency - Google Tag Manager DataLayer controller class | |
use TechSpokes\TrackHospitalitySoftware\Content\Taxonomies\Area; # internal dependency - custom taxonomy controller class | |
use TechSpokes\TrackHospitalitySoftware\Content\Taxonomies\Collection; # internal dependency - custom taxonomy controller class | |
use TechSpokes\TrackHospitalitySoftware\Content\Taxonomies\Company; # internal dependency - custom taxonomy controller class | |
use TechSpokes\TrackHospitalitySoftware\Content\Taxonomies\Complex; # internal dependency - custom taxonomy controller class | |
use TechSpokes\TrackHospitalitySoftware\Content\Taxonomies\LocationType; # internal dependency - custom taxonomy controller class | |
use TechSpokes\TrackHospitalitySoftware\Content\Taxonomies\PropertyType; # internal dependency - custom taxonomy controller class | |
use TechSpokes\TrackHospitalitySoftware\Content\Types\Amenity; # internal dependency - custom post type controller class | |
use TechSpokes\TrackHospitalitySoftware\Content\Types\Reservation; # internal dependency - custom post type controller class | |
use TechSpokes\TrackHospitalitySoftware\Content\Types\VacationRental; # internal dependency - custom post type controller class | |
use TechSpokes\TrackHospitalitySoftware\Tools\Comments; # internal dependency - comments helper class | |
use TechSpokes\TrackHospitalitySoftware\Tools\CountriesList; # internal dependency - countries list helper class | |
use TechSpokes\TrackHospitalitySoftware\Tools\Queries; # internal dependency - DB queries helper class | |
use TechSpokes\TrackHospitalitySoftware\Tools\Scripts; # internal dependency - scripts helper class | |
use TechSpokes\TrackHospitalitySoftware\Traits\IsEmptyStatic; # trait to check if a variable is empty | |
/** | |
* Class Settings | |
* | |
* THIS IS AN EXAMPLE (MODIFIED) OF THE SETTINGS CLASS USED IN ONE OF MY PLUGINS TO BUILD A RATHER COMPLEX UI. | |
* I'LL TRY TO COMMENT DEPENDENCIES AND OTHER STUFF TO MAKE IT EASIER TO UNDERSTAND. | |
* FEEL FREE TO EMAIL ME FOR MORE DETAILS. | |
* | |
* @package TechSpokes\TrackHospitalitySoftware | |
*/ | |
class Settings { | |
// this is a Trait that adds a static method to check if a variable is empty: self::isEmpty($var_to_check_or_function_returning_var_to_check):bool | |
use IsEmptyStatic; | |
/** | |
* @var string The parent page slug (top level menu) for the settings pages. This UI sets all pages under one for convenience. | |
*/ | |
public const SETTINGS_PAGE_SLUG = 'vacation-rentals-settings'; | |
/** | |
* @var \TechSpokes\TrackHospitalitySoftware\Settings|null $instance | |
*/ | |
protected static ?Settings $instance = null; | |
/** | |
* Settings constructor. | |
*/ | |
protected function __construct() { | |
// add configurations top level page | |
add_action( 'admin_menu', array( $this, 'add_configurations_page' ), 2 ); | |
// register UI @see \SergeLiatko\WPSettings\UI for details, also uses a filter to allow overriding the default parameters | |
new UI( apply_filters( 'my_settings_prefix_settings_ui_parameters', $this->get_default_ui_parameters() ) ); | |
// flush rewrite rules on URL settings page display | |
// (custom hook format fired by sergeliatko\wp_settings: after_setting_sections-{$the-settings-page-slug-to-add-action-to} ) | |
add_action( 'after_setting_sections-vacation-rentals-urls', 'flush_rewrite_rules', 10, 0 ); | |
} | |
/** | |
* @return \TechSpokes\TrackHospitalitySoftware\Settings | |
*/ | |
public static function getInstance(): Settings { | |
if ( !( self::$instance instanceof Settings ) ) { | |
self::setInstance( new self() ); | |
} | |
return self::$instance; | |
} | |
/** | |
* @param \TechSpokes\TrackHospitalitySoftware\Settings|null $instance | |
*/ | |
public static function setInstance( ?Settings $instance = null ): void { | |
self::$instance = $instance; | |
} | |
/** | |
* Returns the value of an option from the database allowing to force a default value if the option value returned is empty. | |
* | |
* @param string $option Option name. | |
* @param mixed|false $default Default value to return if the option does not exist. | |
* @param bool $use_default_if_empty If true, the default value will be returned if the option value is empty (exists but evaluates to empty). | |
* | |
* @return false|mixed Value set for the option or false if option does not exist and no default value was provided. | |
*/ | |
public static function get_option( string $option, $default = false, bool $use_default_if_empty = false ) { | |
$value = get_option( $option, $default ); | |
if ( $use_default_if_empty && empty( $value ) ) { | |
$value = $default; | |
} | |
return $value; | |
} | |
/** | |
* @return string - User option for the label of the total taxes line in quote details. | |
* | |
* @since 1.4.1 | |
*/ | |
public static function getOptionQuoteTaxesLabel(): string { | |
return strval( self::get_option( 'my_settings_prefix_option_quote_taxes_label', self::getQuoteTaxesLabelDefault(), true ) ); | |
} | |
/** | |
* @return string - User option for the label of the total taxes line in quote details when taxes are merged. | |
* | |
* @since 1.4.1 | |
*/ | |
public static function getOptionQuoteTaxesLabelMerged(): string { | |
return strval( self::get_option( 'my_settings_prefix_option_quote_taxes_label_merged', self::getQuoteTaxesLabelDefault(), true ) ); | |
} | |
/** | |
* @return bool - User option for the display of the detailed taxes line in quotes. | |
* | |
* @since 1.4.1 | |
*/ | |
public static function getOptionQuoteTaxesMerge(): bool { | |
return (bool) absint( get_option( 'my_settings_prefix_option_quote_taxes_label', 0 ) ); | |
} | |
/** | |
* Returns travel insurance initial quote display type option. (external dependency) | |
* | |
* @return string | |
*/ | |
public static function option_travel_insurance_initial_quote_display_type(): string { | |
return strval( | |
self::get_option( | |
Settings\TravelInsuranceSettings::OPTION_TRAVEL_INSURANCE_INITIAL_QUOTE_DISPLAY_TYPE, | |
Settings\TravelInsuranceSettings::default_quote_display_type(), | |
true | |
) | |
); | |
} | |
/** | |
* Returns travel insurance initial quote amount row label option. (external dependency) | |
* | |
* @return string | |
*/ | |
public static function option_travel_insurance_initial_quote_amount_row_label(): string { | |
return strval( | |
self::get_option( | |
Settings\TravelInsuranceSettings::OPTION_TRAVEL_INSURANCE_INITIAL_QUOTE_AMOUNT_ROW_LABEL, | |
Settings\TravelInsuranceSettings::default_amount_row_label(), | |
true | |
) | |
); | |
} | |
/** | |
* Returns travel insurance initial quote total row label option. (external dependency) | |
* | |
* @return string | |
*/ | |
public static function option_travel_insurance_initial_quote_total_row_label(): string { | |
return strval( | |
self::get_option( | |
Settings\TravelInsuranceSettings::OPTION_TRAVEL_INSURANCE_INITIAL_QUOTE_TOTAL_ROW_LABEL, | |
Settings\TravelInsuranceSettings::default_total_row_label(), | |
true | |
) | |
); | |
} | |
/** | |
* Returns travel insurance initial quote section position option. (external dependency) | |
* | |
* @return string | |
*/ | |
public static function option_travel_insurance_initial_quote_section_position(): string { | |
return strval( | |
self::get_option( | |
Settings\TravelInsuranceSettings::OPTION_TRAVEL_INSURANCE_INITIAL_QUOTE_SECTION_POSITION, | |
Settings\TravelInsuranceSettings::default_section_position(), | |
true | |
) | |
); | |
} | |
/** | |
* Returns travel insurance initial quote section title. (external dependency) | |
* | |
* @return string | |
*/ | |
public static function option_travel_insurance_initial_quote_section_title(): string { | |
return strval( | |
self::get_option( | |
Settings\TravelInsuranceSettings::OPTION_TRAVEL_INSURANCE_INITIAL_QUOTE_SECTION_TITLE, | |
Settings\TravelInsuranceSettings::default_section_title() | |
) | |
); | |
} | |
/** | |
* Returns travel insurance initial quote section content. (external dependency) | |
* | |
* @return string | |
*/ | |
public static function option_travel_insurance_initial_quote_section_content(): string { | |
return strval( | |
self::get_option( | |
Settings\TravelInsuranceSettings::OPTION_TRAVEL_INSURANCE_INITIAL_QUOTE_SECTION_CONTENT, | |
Settings\TravelInsuranceSettings::default_initial_quote_section_content() | |
) | |
); | |
} | |
/** | |
* Returns travel insurance initial quote section fine print. (external dependency) | |
* | |
* @return string | |
*/ | |
public static function option_travel_insurance_initial_quote_section_fine_print(): string { | |
return strval( | |
self::get_option( | |
Settings\TravelInsuranceSettings::OPTION_TRAVEL_INSURANCE_INITIAL_QUOTE_SECTION_FINE_PRINT, | |
'' | |
) | |
); | |
} | |
/** | |
* Returns travel insurance final quote display type option. (external dependency) | |
* | |
* @return string | |
*/ | |
public static function option_travel_insurance_final_quote_display_type(): string { | |
return strval( | |
self::get_option( | |
Settings\TravelInsuranceSettings::OPTION_TRAVEL_INSURANCE_FINAL_QUOTE_DISPLAY_TYPE, | |
Settings\TravelInsuranceSettings::default_quote_display_type(), | |
true | |
) | |
); | |
} | |
/** | |
* Returns travel insurance final quote amount row label option. (external dependency) | |
* | |
* @return string | |
*/ | |
public static function option_travel_insurance_final_quote_amount_row_label(): string { | |
return strval( | |
self::get_option( | |
Settings\TravelInsuranceSettings::OPTION_TRAVEL_INSURANCE_FINAL_QUOTE_AMOUNT_ROW_LABEL, | |
Settings\TravelInsuranceSettings::default_amount_row_label(), | |
true | |
) | |
); | |
} | |
/** | |
* Returns travel insurance final quote total row label option. (external dependency) | |
* | |
* @return string | |
*/ | |
public static function option_travel_insurance_final_quote_total_row_label(): string { | |
return strval( | |
self::get_option( | |
Settings\TravelInsuranceSettings::OPTION_TRAVEL_INSURANCE_FINAL_QUOTE_TOTAL_ROW_LABEL, | |
Settings\TravelInsuranceSettings::default_total_row_label(), | |
true | |
) | |
); | |
} | |
/** | |
* Returns travel insurance final quote section position option. (external dependency) | |
* | |
* @return string | |
*/ | |
public static function option_travel_insurance_final_quote_section_position(): string { | |
return strval( | |
self::get_option( | |
Settings\TravelInsuranceSettings::OPTION_TRAVEL_INSURANCE_FINAL_QUOTE_SECTION_POSITION, | |
Settings\TravelInsuranceSettings::default_section_position(), | |
true | |
) | |
); | |
} | |
/** | |
* Returns travel insurance final quote section title. (external dependency) | |
* | |
* @return string | |
*/ | |
public static function option_travel_insurance_final_quote_section_title(): string { | |
return strval( | |
self::get_option( | |
Settings\TravelInsuranceSettings::OPTION_TRAVEL_INSURANCE_FINAL_QUOTE_SECTION_TITLE, | |
Settings\TravelInsuranceSettings::default_section_title() | |
) | |
); | |
} | |
/** | |
* Returns travel insurance final quote section content. (external dependency) | |
* | |
* @return string | |
*/ | |
public static function option_travel_insurance_final_quote_section_content(): string { | |
return strval( | |
self::get_option( | |
Settings\TravelInsuranceSettings::OPTION_TRAVEL_INSURANCE_FINAL_QUOTE_SECTION_CONTENT, | |
Settings\TravelInsuranceSettings::default_final_quote_section_content() | |
) | |
); | |
} | |
/** | |
* Returns travel insurance final quote section fine print. (external dependency) | |
* | |
* @return string | |
*/ | |
public static function option_travel_insurance_final_quote_section_fine_print(): string { | |
return strval( | |
self::get_option( | |
Settings\TravelInsuranceSettings::OPTION_TRAVEL_INSURANCE_FINAL_QUOTE_SECTION_FINE_PRINT, | |
'' | |
) | |
); | |
} | |
/** | |
* Returns travel insurance booking form display type option. (external dependency) | |
* | |
* @return string | |
*/ | |
public static function option_travel_insurance_booking_form_display_type(): string { | |
return strval( | |
self::get_option( | |
Settings\TravelInsuranceSettings::OPTION_TRAVEL_INSURANCE_BOOKING_FORM_DISPLAY_TYPE, | |
Settings\TravelInsuranceSettings::default_booking_form_display_type(), | |
true | |
) | |
); | |
} | |
/** | |
* Returns travel insurance booking form section title. (external dependency) | |
* | |
* @return string | |
*/ | |
public static function option_travel_insurance_booking_form_section_title(): string { | |
return strval( | |
self::get_option( | |
Settings\TravelInsuranceSettings::OPTION_TRAVEL_INSURANCE_BOOKING_FORM_SECTION_TITLE, | |
Settings\TravelInsuranceSettings::default_section_title(), | |
true | |
) | |
); | |
} | |
/** | |
* Returns travel insurance booking form section content. (external dependency) | |
* | |
* @return string | |
*/ | |
public static function option_travel_insurance_booking_form_section_content(): string { | |
return strval( | |
self::get_option( | |
Settings\TravelInsuranceSettings::OPTION_TRAVEL_INSURANCE_BOOKING_FORM_SECTION_CONTENT, | |
Settings\TravelInsuranceSettings::default_booking_form_section_content() | |
) | |
); | |
} | |
/** | |
* Returns travel insurance booking form section fine print. (external dependency) | |
* | |
* @return string | |
*/ | |
public static function option_travel_insurance_booking_form_section_fine_print(): string { | |
return strval( | |
self::get_option( | |
Settings\TravelInsuranceSettings::OPTION_TRAVEL_INSURANCE_BOOKING_FORM_SECTION_FINE_PRINT, | |
'' | |
) | |
); | |
} | |
/** | |
* Returns travel insurance booking form accept label. (external dependency) | |
* | |
* @return string | |
*/ | |
public static function option_travel_insurance_booking_form_accept_label(): string { | |
return strval( | |
self::get_option( | |
Settings\TravelInsuranceSettings::OPTION_TRAVEL_INSURANCE_BOOKING_FORM_ACCEPT_LABEL, | |
Settings\TravelInsuranceSettings::default_booking_form_accept_label(), | |
true | |
) | |
); | |
} | |
/** | |
* Returns travel insurance booking form decline label. (external dependency) | |
* | |
* @return string | |
*/ | |
public static function option_travel_insurance_booking_form_decline_label(): string { | |
return strval( | |
self::get_option( | |
Settings\TravelInsuranceSettings::OPTION_TRAVEL_INSURANCE_BOOKING_FORM_DECLINE_LABEL, | |
Settings\TravelInsuranceSettings::default_booking_form_decline_label(), | |
true | |
) | |
); | |
} | |
/** | |
* Default values for the settings. | |
*/ | |
/** | |
* @return string | |
*/ | |
public static function getDescriptionTabTitleDefault(): string { | |
return __( 'Description', 'my-cool-plugin-text-domain' ); | |
} | |
/** | |
* @return string | |
*/ | |
public static function getQuoteTaxesLabelDefault(): string { | |
return __( 'Total taxes', 'my-cool-plugin-text-domain' ); | |
} | |
/** | |
* Adds the list of accepted HTML tags to the help text. | |
* | |
* @param string $help_text The original help text. | |
* @param array $tags List of HTML tags. | |
* | |
* @return string The help text with the list of accepted HTML tags. | |
*/ | |
public static function help_text_add_accepted_html_tags( string $help_text, array $tags = array() ): string { | |
// Filter out empty and non-string tags. | |
$tags = array_filter( | |
$tags, | |
function ( $tag ) { | |
return !empty( $tag ) && is_string( $tag ); | |
} | |
); | |
// If there are no tags, return the original help text. | |
if ( empty( $tags ) ) { | |
return $help_text; | |
} | |
// Wrap the tags in <code> tags. | |
$tags = array_map( | |
function ( string $tag ) { | |
return sprintf( '<code><%s></code>', strtolower( $tag ) ); | |
}, | |
$tags | |
); | |
return trim( | |
join( | |
' ', | |
array( | |
$help_text, | |
sprintf( | |
/* translators: %s: list of HTML tags */ | |
__( 'Accepted HTML tags: %s.', 'my-cool-plugin-text-domain' ), | |
join( ', ', $tags ) | |
), | |
) | |
) | |
); | |
} | |
/** | |
* Adds the configurations page (top level) to the admin menu. | |
* | |
* @return void | |
*/ | |
public function add_configurations_page(): void { | |
add_menu_page( | |
__( 'Configurations', 'my-cool-plugin-text-domain' ), | |
__( 'Configurations', 'my-cool-plugin-text-domain' ), | |
'manage_options', | |
self::SETTINGS_PAGE_SLUG, | |
'',# no callback as we are using this as a menu placeholder to add submenus defined in UI parameters (better order control). But you may use it if you want. | |
'dashicons-admin-settings', | |
40 | |
); | |
} | |
/** | |
* @return array[] Array of UI parameters to build the admin UI. | |
*/ | |
protected function get_default_ui_parameters(): array { | |
// Vacation Rentals Settings: | |
return array( | |
// providing the 'pages' in the parameters array will create admin pages for each item in the array. | |
'pages' => array( | |
// General Settings Page | |
array( | |
'slug' => self::SETTINGS_PAGE_SLUG, # the sug of the page, matches to the parent page to lock the primary page in the 1st position in the submenu. | |
'parent' => self::SETTINGS_PAGE_SLUG, # the slug of the parent page, matches to the page slug to lock the primary page in the 1st position in the submenu. | |
'position' => 1, # 1st position in the submenu. | |
'label' => __( 'General Settings', 'my-cool-plugin-text-domain' ), | |
'title' => __( 'General Settings', 'my-cool-plugin-text-domain' ), | |
// defines the sections to add to the page | |
'sections' => array( | |
array( | |
'id' => 'search-results', | |
'title' => __( 'Search results', 'my-cool-plugin-text-domain' ), | |
// 'description' => __( 'Add your cool description of needed.', 'my-cool-plugin-text-domain' ), | |
// defines the fields to add to the section | |
'settings' => array( | |
// the first setting - the UI and other classes in the package will take care of option registration sanitizing, etc. | |
array( | |
'option' => 'my_settings_prefix_search_no_availability_page_id', | |
'type' => 'select', | |
'label' => __( 'No availability page', 'my-cool-plugin-text-domain' ), | |
'help' => __( 'Select a page to display when no units are available for selected dates.', 'my-cool-plugin-text-domain' ), | |
'sanitize_callback' => 'absint', | |
'data_type' => 'integer', # datatype for the setting registration in WP, if not provided it will be dynamically "guessed" from the setting type of fallback to "string" | |
// usually it is the best to provide a static value when possible, | |
// here using a function to get the options for the select field, | |
// good practice is to cache the queries as it will be called on every page load | |
// or even better to use a custom callback for the field where the options are pulled dynamically when the field is displayed. | |
'choices' => Queries::getPagesDropDownOptions(), # this function returns the options for the select field in following format: ['My option 1 Label'=> 'option_1_value', 'My option 2 Label'=> 123, ...], labels go always first as they are strings used as keys for the array. | |
'default' => 0, | |
), | |
array( | |
'option' => 'my_settings_prefix_search_too_restrictive_page_id', | |
'type' => 'select', | |
'label' => __( 'Too restrictive criteria page', 'my-cool-plugin-text-domain' ), | |
'help' => __( 'Select a page to display when search criteria are too restrictive.', 'my-cool-plugin-text-domain' ), | |
'sanitize_callback' => 'absint', | |
'data_type' => 'integer', | |
'choices' => Queries::getPagesDropDownOptions(), # this function returns the options for the select field in following format: ['My option 1 Label'=> 'option_1_value', 'My option 2 Label'=> 123, ...], labels go always first as they are strings used as keys for the array. | |
'default' => 0, | |
), | |
), | |
), | |
// next section | |
// Maps section | |
array( | |
'id' => 'maps', | |
'title' => __( 'Maps', 'my-cool-plugin-text-domain' ), | |
// settings for the section | |
'settings' => array( | |
array( | |
'option' => 'my_settings_prefix_google_maps_api_key', | |
// default 'type' is text, so not specified here | |
'label' => __( 'Google Maps API Key', 'my-cool-plugin-text-domain' ), | |
'help' => __( 'To display maps, please enter here the Google Maps API key.', 'my-cool-plugin-text-domain' ), | |
'sanitize_callback' => 'sanitize_text_field',# sanitize callback for the option value | |
// input attributes will be applied to the input field | |
'input_attrs' => array( | |
'class' => 'large-text code', | |
), | |
), | |
), | |
), | |
// Shareaholic section | |
array( | |
'id' => 'shareaholic', | |
'title' => __( 'Sharing buttons', 'my-cool-plugin-text-domain' ), | |
'description' => __( 'If you are using Shareaholic plugin you can display sharing buttons on property index pages by entering app ID here.', 'my-cool-plugin-text-domain' ), | |
'settings' => array( | |
array( | |
'option' => 'my_settings_prefix_shareaholic_app_id', | |
'label' => __( 'Shareaholic in-page app ID', 'my-cool-plugin-text-domain' ), | |
'sanitize_callback' => 'sanitize_text_field', | |
'input_attrs' => array( | |
'class' => 'regular-text code', | |
), | |
), | |
), | |
), | |
array( | |
'id' => 'checkin_checkout', | |
'title' => __( 'Checkin / Checkout', 'my-cool-plugin-text-domain' ), | |
'settings' => array( | |
array( | |
'option' => 'my_settings_prefix_default_checkin_time', | |
'type' => 'time',#input type="time" as an extension of the text input type | |
'label' => __( 'Default checkin time', 'my-cool-plugin-text-domain' ), | |
'help' => __( 'Default checkin time to use.', 'my-cool-plugin-text-domain' ), | |
'default' => '15:00', | |
'force_default' => true,#will force the get_option() to return the default value when empty option was saved by the user | |
'input_attrs' => array( | |
'class' => 'regular-text code', | |
), | |
), | |
array( | |
'option' => 'my_settings_prefix_default_early_checkin_time', | |
'type' => 'time', | |
'label' => __( 'Default early checkin time', 'my-cool-plugin-text-domain' ), | |
'help' => __( 'Default early checkin time to use.', 'my-cool-plugin-text-domain' ), | |
'default' => '13:00', | |
'force_default' => true, | |
'input_attrs' => array( | |
'class' => 'regular-text code', | |
), | |
), | |
array( | |
'option' => 'my_settings_prefix_default_checkout_time', | |
'type' => 'time', | |
'label' => __( 'Default checkout time', 'my-cool-plugin-text-domain' ), | |
'help' => __( 'Default checkout time to use.', 'my-cool-plugin-text-domain' ), | |
'default' => '10:00', | |
'force_default' => true, | |
'input_attrs' => array( | |
'class' => 'regular-text code', | |
), | |
), | |
array( | |
'option' => 'my_settings_prefix_default_late_checkin_time', | |
'type' => 'time', | |
'label' => __( 'Default late checkout time', 'my-cool-plugin-text-domain' ), | |
'help' => __( 'Default late checkout time to use.', 'my-cool-plugin-text-domain' ), | |
'default' => '12:00', | |
'force_default' => true, | |
'input_attrs' => array( | |
'class' => 'regular-text code', | |
), | |
), | |
), | |
), | |
// Payments section | |
array( | |
'id' => 'payments', | |
'title' => __( 'Payments', 'my-cool-plugin-text-domain' ), | |
'settings' => array( | |
array( | |
'option' => 'my_settings_prefix_lang_payments_methods_card_label', | |
'label' => __( 'Card payments label', 'my-cool-plugin-text-domain' ), | |
'input_attrs' => array( | |
'class' => 'large-text', | |
), | |
'default' => __( 'Debit / Credit Card', 'my-cool-plugin-text-domain' ), | |
'force_default' => true, | |
'sanitize_callback' => 'sanitize_text_field', | |
), | |
array( | |
'option' => 'my_settings_prefix_lang_payments_methods_bank_account_label', | |
'label' => __( 'eCheck payments label', 'my-cool-plugin-text-domain' ), | |
'input_attrs' => array( | |
'class' => 'large-text', | |
), | |
'default' => __( 'Electronic Check', 'my-cool-plugin-text-domain' ), | |
'force_default' => true, | |
'sanitize_callback' => 'sanitize_text_field', | |
), | |
), | |
), | |
// Money section | |
array( | |
'id' => 'money', | |
'title' => __( 'Money display', 'my-cool-plugin-text-domain' ), | |
'settings' => array( | |
array( | |
'option' => 'my_settings_prefix_money_currency_symbol', | |
'label' => __( 'Currency symbol', 'my-cool-plugin-text-domain' ), | |
'help' => __( 'Currency symbol to display.', 'my-cool-plugin-text-domain' ), | |
'input_attrs' => array( | |
'class' => 'tiny-text code', | |
), | |
), | |
array( | |
'option' => 'my_settings_prefix_money_currency_symbol_trailing', | |
'type' => 'checkbox',# input type="checkbox" is rather simple to implement, the saved value will be '1' when checked and '0' when unchecked | |
'label' => __( 'Display currency symbol after the amount', 'my-cool-plugin-text-domain' ), | |
), | |
array( | |
'option' => 'my_settings_prefix_money_thousands_separator', | |
'label' => __( 'Thousands separator', 'my-cool-plugin-text-domain' ), | |
'help' => __( 'Thousands separator to use.', 'my-cool-plugin-text-domain' ), | |
'default' => ' ', | |
'force_default' => true, | |
'sanitize_callback' => '\TechSpokes\TrackHospitalitySoftware\Tools\Sanitizers::sanitize_text_field_allow_one_space', | |
'input_attrs' => array( | |
'class' => 'tiny-text code', | |
), | |
), | |
array( | |
'option' => 'my_settings_prefix_money_decimal_separator', | |
'label' => __( 'Cents separator', 'my-cool-plugin-text-domain' ), | |
'help' => __( 'Cents separator to use.', 'my-cool-plugin-text-domain' ), | |
'default' => '.', | |
'force_default' => true, | |
'input_attrs' => array( | |
'class' => 'tiny-text code', | |
), | |
), | |
), | |
), | |
// Booking section | |
array( | |
'id' => 'booking', | |
'title' => __( 'Booking', 'my-cool-plugin-text-domain' ), | |
'settings' => array( | |
array( | |
'option' => 'my_settings_prefix_online_booking_page_id', | |
'type' => 'select', | |
'label' => __( 'Booking page', 'my-cool-plugin-text-domain' ), | |
'help' => __( 'Please select a page to display online booking form.', 'my-cool-plugin-text-domain' ), | |
'default' => 0, | |
'sanitize_callback' => 'absint', | |
'data_type' => 'integer',# the data type to use when registering the setting in WP (string is the default) | |
'choices' => Queries::getPagesDropDownOptions(),# @see above for details on using functions to generate options for the dropdown | |
), | |
array( | |
'option' => 'my_settings_prefix_default_country', | |
'type' => 'select', | |
'label' => __( 'Default country', 'my-cool-plugin-text-domain' ), | |
'help' => __( 'Please select a country to be used as default in country dropdowns.', 'my-cool-plugin-text-domain' ), | |
'default' => 'US', | |
'force_default' => true, | |
'sanitize_callback' => 'sanitize_text_field', | |
'data_type' => 'string', | |
'choices' => CountriesList::getCountries(), | |
), | |
array( | |
'option' => 'my_settings_prefix_booking_travel_insurance_title', | |
'label' => __( 'Travel insurance title', 'my-cool-plugin-text-domain' ), | |
'help' => __( 'Title for travel insurance section', 'my-cool-plugin-text-domain' ), | |
'default' => __( 'Travel insurance', 'my-cool-plugin-text-domain' ), | |
'force_default' => true, | |
'input_attrs' => array( | |
'class' => 'widefat', | |
), | |
), | |
array( | |
'option' => 'my_settings_prefix_booking_travel_insurance_description', | |
'type' => 'textarea', # will generate a textarea field | |
'label' => __( 'Travel insurance description', 'my-cool-plugin-text-domain' ), | |
// help string is displayed underneath the field | |
'help' => sprintf( | |
__( 'Use %1$s for travel insurance cost, %2$s for reservation cost and %3$s for the total cost with travel insurance.', 'my-cool-plugin-text-domain' ), | |
'<strong>{insuranceCost}</strong>', | |
'<strong>{reservationCost}</strong>', | |
'<strong>{totalCost}</strong>' | |
), | |
'default' => __( 'Further down, you may also opt in for a travel insurance at additional amount of {insuranceCost} to protect your accommodation investment in the event that any unforeseen circumstances would cause you to cancel and loose the full amount paid.', 'my-cool-plugin-text-domain' ), | |
'force_default' => true, | |
// input_attrs are attributes to be added to the input field (textarea tag in this case) | |
'input_attrs' => array( | |
'class' => 'widefat', | |
'rows' => 3, | |
), | |
), | |
array( | |
'option' => 'my_settings_prefix_booking_travel_insurance_acceptance', | |
'type' => 'textarea', | |
'label' => __( 'Accept travel insurance text', 'my-cool-plugin-text-domain' ), | |
'help' => sprintf( | |
__( 'Use %1$s for travel insurance cost, %2$s for reservation cost and %3$s for the total cost with travel insurance.', 'my-cool-plugin-text-domain' ), | |
'<strong>{insuranceCost}</strong>', | |
'<strong>{reservationCost}</strong>', | |
'<strong>{totalCost}</strong>' | |
), | |
'default' => __( 'Yes, please include travel insurance for the amount of {insuranceCost} to protect my vacation accommodation investment in the event that any unforeseen circumstances would cause me to cancel and lose the full amount paid.', 'my-cool-plugin-text-domain' ), | |
'force_default' => true, | |
'input_attrs' => array( | |
'class' => 'widefat', | |
'rows' => 3, | |
// you may also add the default as placeholder so that the user sees what is the default value even if they delete the text | |
), | |
), | |
array( | |
'option' => 'my_settings_prefix_booking_travel_insurance_decline', | |
'type' => 'textarea', | |
'label' => __( 'Decline travel insurance text', 'my-cool-plugin-text-domain' ), | |
'help' => sprintf( | |
__( 'Use %1$s for travel insurance cost, %2$s for reservation cost and %3$s for the total cost with travel insurance.', 'my-cool-plugin-text-domain' ), | |
'<strong>{insuranceCost}</strong>', | |
'<strong>{reservationCost}</strong>', | |
'<strong>{totalCost}</strong>' | |
), | |
'default' => __( 'No, do not include travel insurance. By declining I understand that I could lose my full payment of {reservationCost} should any unforeseen circumstances cause me to cancel my trip.', 'my-cool-plugin-text-domain' ), | |
'force_default' => true, | |
'input_attrs' => array( | |
'class' => 'widefat', | |
'rows' => 3, | |
), | |
), | |
array( | |
'option' => 'my_settings_prefix_lang_extra_fields_title', | |
'label' => __( 'Extra fields title', 'my-cool-plugin-text-domain' ), | |
'help' => __( 'Title for extra fields section', 'my-cool-plugin-text-domain' ), | |
'default' => __( 'Additional information', 'my-cool-plugin-text-domain' ), | |
'force_default' => true, | |
'input_attrs' => array( | |
'class' => 'widefat', | |
), | |
), | |
array( | |
'option' => 'my_settings_prefix_booking_submit_label', | |
'label' => __( 'Submit booking button', 'my-cool-plugin-text-domain' ), | |
'help' => __( 'Label for submit booking button.', 'my-cool-plugin-text-domain' ), | |
'default' => __( 'Book this property', 'my-cool-plugin-text-domain' ), | |
'force_default' => true, | |
'input_attrs' => array( | |
'class' => 'widefat', | |
), | |
), | |
), | |
), | |
), | |
), | |
// Calendar Settings Page | |
// creating another page in admin menu, as the parent is specified, it will add it as a submenu item | |
array( | |
'slug' => 'calendar-settings', # slug for the settings sub-page (and for URL) | |
'parent' => self::SETTINGS_PAGE_SLUG,# if not present in the array, a top page will be created | |
'position' => 10, | |
'label' => __( 'Calendar Settings', 'my-cool-plugin-text-domain' ), | |
'title' => __( 'Calendar Settings', 'my-cool-plugin-text-domain' ), | |
'sections' => array( | |
// General Section | |
array( | |
'id' => 'defaults', | |
'title' => __( 'Global default settings', 'my-cool-plugin-text-domain' ), | |
'settings' => array( | |
array( | |
'option' => 'my_settings_prefix_calendar_date_format', | |
'label' => __( 'Date format', 'my-cool-plugin-text-domain' ), | |
'help' => __( 'Used as fallback date format for date fields.', 'my-cool-plugin-text-domain' ), | |
'default' => 'Y-m-d', | |
'force_default' => true, | |
'input_attrs' => array( | |
'placeholder' => 'Y-m-d', | |
), | |
), | |
array( | |
'option' => 'my_settings_prefix_calendar_booking_window', | |
'type' => 'number',# input type="number" as a child class of the input type="text" | |
'label' => __( 'Booking window', 'my-cool-plugin-text-domain' ), | |
'default' => 365, | |
'force_default' => true, | |
'input_attrs' => array( | |
'placeholder' => '365', | |
'min' => 1, | |
'step' => 1, | |
), | |
), | |
array( | |
'option' => SiteOption::MIN_BOOKING_WINDOW, | |
'type' => 'number', | |
'label' => __( 'Minimum days in advance', 'my-cool-plugin-text-domain' ), | |
'input_attrs' => array( | |
'placeholder' => '0', | |
'min' => 0, | |
'step' => 1, | |
), | |
), | |
array( | |
'option' => 'my_settings_prefix_calendar_min_stay', | |
'type' => 'number', | |
'label' => __( 'Minimum stay', 'my-cool-plugin-text-domain' ), | |
'default' => 1, | |
'force_default' => true, | |
'input_attrs' => array( | |
'placeholder' => '1', | |
'min' => 1, | |
'step' => 1, | |
), | |
), | |
array( | |
'option' => 'my_settings_prefix_calendar_max_stay', | |
'type' => 'number', | |
'label' => __( 'Maximum stay', 'my-cool-plugin-text-domain' ), | |
'default' => 180, | |
'force_default' => true, | |
'input_attrs' => array( | |
'placeholder' => '180', | |
'min' => 1, | |
'step' => 1, | |
), | |
), | |
), | |
), | |
// Rates Section | |
array( | |
'id' => 'rates', | |
'title' => __( 'Rates display', 'my-cool-plugin-text-domain' ), | |
'settings' => array( | |
array( | |
'option' => 'my_settings_prefix_calendar_show_rates', | |
'type' => 'checkbox', | |
'label' => __( 'Show rates', 'my-cool-plugin-text-domain' ), | |
), | |
array( | |
'option' => 'my_settings_prefix_calendar_hide_unavailable_rates', | |
'type' => 'checkbox', | |
'label' => __( 'Hide rates for unavailable dates', 'my-cool-plugin-text-domain' ), | |
), | |
array( | |
'option' => 'my_settings_prefix_calendar_prices_hide_cents', | |
'type' => 'checkbox', | |
'label' => __( 'Hide cents in rates', 'my-cool-plugin-text-domain' ), | |
), | |
), | |
), | |
// Messages Section | |
array( | |
'id' => 'messages', | |
'title' => __( 'Messages', 'my-cool-plugin-text-domain' ), | |
'settings' => array( | |
array( | |
'option' => 'my_settings_prefix_calendar_messages_available', | |
'label' => __( 'Available', 'my-cool-plugin-text-domain' ), | |
'help' => __( 'Shown for available dates.', 'my-cool-plugin-text-domain' ), | |
'default' => __( 'Available.', 'my-cool-plugin-text-domain' ), | |
'force_default' => true, | |
'type' => 'textarea',# using textarea here with 1 row in attributes to allow the user to expand the field height if needed | |
'input_attrs' => array( | |
'rows' => '1', | |
), | |
), | |
array( | |
'option' => 'my_settings_prefix_calendar_messages_unavailable', | |
'label' => __( 'Unavailable', 'my-cool-plugin-text-domain' ), | |
'help' => __( 'Shown for unavailable dates.', 'my-cool-plugin-text-domain' ), | |
'default' => __( 'Booked.', 'my-cool-plugin-text-domain' ), | |
'force_default' => true, | |
'type' => 'textarea', | |
'input_attrs' => array( | |
'rows' => '1', | |
), | |
), | |
array( | |
'option' => 'my_settings_prefix_calendar_messages_arrivals_allowed', | |
'label' => __( 'Arrivals allowed', 'my-cool-plugin-text-domain' ), | |
'help' => __( 'Shown for dates with arrivals allowed.', 'my-cool-plugin-text-domain' ), | |
'default' => __( 'Arrivals are allowed.', 'my-cool-plugin-text-domain' ), | |
'force_default' => true, | |
'type' => 'textarea', | |
'input_attrs' => array( | |
'rows' => '1', | |
), | |
), | |
array( | |
'option' => 'my_settings_prefix_calendar_messages_arrivals_not_allowed', | |
'label' => __( 'Arrivals not allowed', 'my-cool-plugin-text-domain' ), | |
'help' => __( 'Shown for dates with arrivals prohibited.', 'my-cool-plugin-text-domain' ), | |
'default' => __( 'Arrivals are not allowed.', 'my-cool-plugin-text-domain' ), | |
'force_default' => true, | |
'type' => 'textarea', | |
'input_attrs' => array( | |
'rows' => '1', | |
), | |
), | |
array( | |
'option' => 'my_settings_prefix_calendar_messages_departures_allowed', | |
'label' => __( 'Departures allowed', 'my-cool-plugin-text-domain' ), | |
'help' => __( 'Shown for dates with departures allowed.', 'my-cool-plugin-text-domain' ), | |
'default' => __( 'Departures are allowed.', 'my-cool-plugin-text-domain' ), | |
'force_default' => true, | |
'type' => 'textarea', | |
'input_attrs' => array( | |
'rows' => '1', | |
), | |
), | |
array( | |
'option' => 'my_settings_prefix_calendar_messages_departures_not_allowed', | |
'label' => __( 'Departures not allowed', 'my-cool-plugin-text-domain' ), | |
'help' => __( 'Shown for dates with departures prohibited.', 'my-cool-plugin-text-domain' ), | |
'default' => __( 'Departures are not allowed.', 'my-cool-plugin-text-domain' ), | |
'force_default' => true, | |
'type' => 'textarea', | |
'input_attrs' => array( | |
'rows' => '1', | |
), | |
), | |
array( | |
'option' => 'my_settings_prefix_calendar_messages_rate', | |
'label' => __( 'Rate', 'my-cool-plugin-text-domain' ), | |
'help' => sprintf( | |
__( 'Rate description text. %s will be replaced by the actual rate.', 'my-cool-plugin-text-domain' ), | |
'<strong><code>{rate}</code></strong>' | |
), | |
'default' => __( 'Rates from {rate}/night.', 'my-cool-plugin-text-domain' ), | |
'force_default' => true, | |
'type' => 'textarea', | |
'input_attrs' => array( | |
'rows' => '1', | |
), | |
), | |
array( | |
'option' => 'my_settings_prefix_calendar_messages_old_rate', | |
'label' => __( 'Previous Rate', 'my-cool-plugin-text-domain' ), | |
'help' => sprintf( | |
__( 'Previous rate description text. %s will be replaced by the previous rate.', 'my-cool-plugin-text-domain' ), | |
'<strong><code>{oldRate}</code></strong>' | |
), | |
'default' => __( 'Previously from {oldRate}/night.', 'my-cool-plugin-text-domain' ), | |
'force_default' => true, | |
'type' => 'textarea', | |
'input_attrs' => array( | |
'rows' => '1', | |
), | |
), | |
array( | |
'option' => 'my_settings_prefix_calendar_messages_min_stay', | |
'label' => __( 'Minimum stay', 'my-cool-plugin-text-domain' ), | |
'help' => sprintf( | |
__( 'Minimum stay description text. %s will be replaced by the actual number of days.', 'my-cool-plugin-text-domain' ), | |
'<strong><code>{minimumStay}</code></strong>' | |
), | |
'default' => __( 'Minimum stay is {minimumStay} night(s).', 'my-cool-plugin-text-domain' ), | |
'force_default' => true, | |
'type' => 'textarea', | |
'input_attrs' => array( | |
'rows' => '1', | |
), | |
), | |
array( | |
'option' => 'my_settings_prefix_calendar_messages_min_stay_conflict', | |
'label' => __( 'Minimum stay conflict', 'my-cool-plugin-text-domain' ), | |
'help' => __( 'Shown for dates when minimum stay rule is violated.', 'my-cool-plugin-text-domain' ), | |
'default' => __( 'Your departure cannot be prior to minimum stay requirement.', 'my-cool-plugin-text-domain' ), | |
'force_default' => true, | |
'type' => 'textarea', | |
'input_attrs' => array( | |
'rows' => '1', | |
), | |
), | |
array( | |
'option' => 'my_settings_prefix_calendar_messages_selected_arrival', | |
'label' => __( 'Selected arrival', 'my-cool-plugin-text-domain' ), | |
'help' => __( 'Shown for dates selected as arrival.', 'my-cool-plugin-text-domain' ), | |
'default' => __( 'Your selected arrival date.', 'my-cool-plugin-text-domain' ), | |
'force_default' => true, | |
'type' => 'textarea', | |
'input_attrs' => array( | |
'rows' => '1', | |
), | |
), | |
array( | |
'option' => 'my_settings_prefix_calendar_messages_selected_stay', | |
'label' => __( 'Selected stay', 'my-cool-plugin-text-domain' ), | |
'help' => __( 'Shown for dates within selected stay period.', 'my-cool-plugin-text-domain' ), | |
'default' => __( 'Your selected stay.', 'my-cool-plugin-text-domain' ), | |
'force_default' => true, | |
'type' => 'textarea', | |
'input_attrs' => array( | |
'rows' => '1', | |
), | |
), | |
array( | |
'option' => 'my_settings_prefix_calendar_messages_selected_departure', | |
'label' => __( 'Selected departure', 'my-cool-plugin-text-domain' ), | |
'help' => __( 'Shown for dates selected as departures.', 'my-cool-plugin-text-domain' ), | |
'default' => __( 'Your selected departure date.', 'my-cool-plugin-text-domain' ), | |
'force_default' => true, | |
'type' => 'textarea', | |
'input_attrs' => array( | |
'rows' => '1', | |
), | |
), | |
array( | |
'option' => 'my_settings_prefix_calendar_messages_selected_dates_conflict', | |
'label' => __( 'Dates conflict', 'my-cool-plugin-text-domain' ), | |
'help' => __( 'Shown for dates within selected stay period that conflict with availability or booking rules.', 'my-cool-plugin-text-domain' ), | |
'default' => __( 'This date availability or booking rules conflict with your selected dates.', 'my-cool-plugin-text-domain' ), | |
'force_default' => true, | |
'type' => 'textarea', | |
'input_attrs' => array( | |
'rows' => '1', | |
), | |
), | |
array( | |
'option' => 'my_settings_prefix_calendar_messages_selected_arrival_conflict', | |
'label' => __( 'Arrival conflict', 'my-cool-plugin-text-domain' ), | |
'help' => __( 'Shown for arrival date that conflicts with availability or booking rules.', 'my-cool-plugin-text-domain' ), | |
'default' => __( 'Arrival is not possible on this date.', 'my-cool-plugin-text-domain' ), | |
'force_default' => true, | |
'type' => 'textarea', | |
'input_attrs' => array( | |
'rows' => '1', | |
), | |
), | |
array( | |
'option' => 'my_settings_prefix_calendar_messages_selected_departure_conflict', | |
'label' => __( 'Departure conflict', 'my-cool-plugin-text-domain' ), | |
'help' => __( 'Shown for departure date that conflicts with availability or booking rules.', 'my-cool-plugin-text-domain' ), | |
'default' => __( 'Departure is not possible on this date.', 'my-cool-plugin-text-domain' ), | |
'force_default' => true, | |
'type' => 'textarea', | |
'input_attrs' => array( | |
'rows' => '1', | |
), | |
), | |
array( | |
'option' => 'my_settings_prefix_calendar_messages_selected_stay_conflict', | |
'label' => __( 'Stay conflict', 'my-cool-plugin-text-domain' ), | |
'help' => __( 'Shown for selected stay dates that conflict with availability or booking rules.', 'my-cool-plugin-text-domain' ), | |
'default' => __( 'Stay date conflicts with rules or availability.', 'my-cool-plugin-text-domain' ), | |
'force_default' => true, | |
'type' => 'textarea', | |
'input_attrs' => array( | |
'rows' => '1', | |
), | |
), | |
array( | |
'option' => 'my_settings_prefix_calendar_messages_minimum_stay_period', | |
'label' => __( 'Minimum stay period', 'my-cool-plugin-text-domain' ), | |
'help' => __( 'Shown for dates within highlighted minimum stay period.', 'my-cool-plugin-text-domain' ), | |
'default' => __( 'Minimum stay.', 'my-cool-plugin-text-domain' ), | |
'force_default' => true, | |
'type' => 'textarea', | |
'input_attrs' => array( | |
'rows' => '1', | |
), | |
), | |
array( | |
'option' => 'my_settings_prefix_calendar_messages_first_departure', | |
'label' => __( 'First available departure', 'my-cool-plugin-text-domain' ), | |
'help' => __( 'Shown for the date first available as departure.', 'my-cool-plugin-text-domain' ), | |
'default' => __( 'First available departure.', 'my-cool-plugin-text-domain' ), | |
'force_default' => true, | |
'type' => 'textarea', | |
'input_attrs' => array( | |
'rows' => '1', | |
), | |
), | |
array( | |
'option' => 'my_settings_prefix_calendar_messages_select_another_date', | |
'label' => __( 'Select another date', 'my-cool-plugin-text-domain' ), | |
'help' => __( 'Generic message added to the end of error messages to ask visitor to select another date or contact you for assistance.', 'my-cool-plugin-text-domain' ), | |
'default' => __( 'Please select another date or call us for assistance.', 'my-cool-plugin-text-domain' ), | |
'force_default' => true, | |
'type' => 'textarea', | |
'input_attrs' => array( | |
'rows' => '1', | |
), | |
), | |
array( | |
'option' => 'my_settings_prefix_calendar_messages_arrival_impossible', | |
'label' => __( 'Arrival impossible', 'my-cool-plugin-text-domain' ), | |
'help' => __( 'Is displayed when visitor selects an arrival date that violates minimum stay booking rules.', 'my-cool-plugin-text-domain' ), | |
'default' => __( 'Sorry, minimum stay requirement does not allow to arrive on this date.', 'my-cool-plugin-text-domain' ), | |
'force_default' => true, | |
'type' => 'textarea', | |
'input_attrs' => array( | |
'rows' => '1', | |
), | |
), | |
array( | |
'option' => 'my_settings_prefix_calendar_messages_select_arrival_date', | |
'label' => __( 'Select arrival', 'my-cool-plugin-text-domain' ), | |
'help' => __( 'Is displayed above the calendar when no arrival date is selected.', 'my-cool-plugin-text-domain' ), | |
'default' => __( 'Please select you arrival date.', 'my-cool-plugin-text-domain' ), | |
'force_default' => true, | |
'type' => 'textarea', | |
'input_attrs' => array( | |
'rows' => '1', | |
), | |
), | |
array( | |
'option' => 'my_settings_prefix_calendar_messages_modify_arrival_date', | |
'label' => __( 'Modify arrival', 'my-cool-plugin-text-domain' ), | |
'help' => __( 'Is displayed above the calendar when an arrival date is selected.', 'my-cool-plugin-text-domain' ), | |
'default' => __( 'If needed, modify your arrival date.', 'my-cool-plugin-text-domain' ), | |
'force_default' => true, | |
'type' => 'textarea', | |
'input_attrs' => array( | |
'rows' => '1', | |
), | |
), | |
array( | |
'option' => 'my_settings_prefix_calendar_messages_confirm_departure_date', | |
'label' => __( 'Confirm departure', 'my-cool-plugin-text-domain' ), | |
'help' => __( 'Is displayed above the calendar when it is waiting for departure date.', 'my-cool-plugin-text-domain' ), | |
'default' => __( 'Please confirm your departure date.', 'my-cool-plugin-text-domain' ), | |
'force_default' => true, | |
'type' => 'textarea', | |
'input_attrs' => array( | |
'rows' => '1', | |
), | |
), | |
array( | |
'option' => 'my_settings_prefix_calendar_messages_alert_no_arrivals', | |
'label' => __( 'Arrivals are not allowed alert', 'my-cool-plugin-text-domain' ), | |
'help' => __( 'Alert displayed when visitor clicks on dates with no arrivals allowed.', 'my-cool-plugin-text-domain' ), | |
'default' => __( 'Sorry, arrivals are not allowed on this day.', 'my-cool-plugin-text-domain' ), | |
'force_default' => true, | |
'type' => 'textarea', | |
'input_attrs' => array( | |
'rows' => '1', | |
), | |
), | |
array( | |
'option' => 'my_settings_prefix_calendar_messages_alert_no_departures', | |
'label' => __( 'Departures are not allowed alert', 'my-cool-plugin-text-domain' ), | |
'help' => __( 'Alert displayed when visitor clicks on dates with no departures allowed.', 'my-cool-plugin-text-domain' ), | |
'default' => __( 'Sorry, departures are not allowed on this day.', 'my-cool-plugin-text-domain' ), | |
'force_default' => true, | |
'type' => 'textarea', | |
'input_attrs' => array( | |
'rows' => '1', | |
), | |
), | |
array( | |
'option' => 'my_settings_prefix_calendar_messages_legend_no_arrivals_departures', | |
'label' => __( 'Arrivals/Departures not allowed legend', 'my-cool-plugin-text-domain' ), | |
'help' => __( 'Explains date with arrivals/departures not allowed in calendar help section.', 'my-cool-plugin-text-domain' ), | |
'default' => __( 'Date is available, but arrivals/departures are not allowed on this day.', 'my-cool-plugin-text-domain' ), | |
'force_default' => true, | |
'type' => 'textarea', | |
'input_attrs' => array( | |
'rows' => '1', | |
), | |
), | |
array( | |
'option' => 'my_settings_prefix_calendar_messages_legend_conflict', | |
'label' => __( 'Conflict legend', 'my-cool-plugin-text-domain' ), | |
'help' => __( 'Explains conflict date in calendar help section.', 'my-cool-plugin-text-domain' ), | |
'default' => __( 'Selected date is unavailable or conflicts with booking rules (minimum stay/allowed arrivals or departures).', 'my-cool-plugin-text-domain' ), | |
'force_default' => true, | |
'type' => 'textarea', | |
'input_attrs' => array( | |
'rows' => '1', | |
), | |
), | |
array( | |
'option' => 'my_settings_prefix_calendar_messages_legend_reset', | |
'label' => __( 'Modify arrival date legend', 'my-cool-plugin-text-domain' ), | |
'help' => __( 'Explains how to modify arrival date.', 'my-cool-plugin-text-domain' ), | |
'default' => __( 'To modify the arrival date, make sure you have confirmed the departure date.', 'my-cool-plugin-text-domain' ), | |
'force_default' => true, | |
'type' => 'textarea', | |
'input_attrs' => array( | |
'rows' => '1', | |
), | |
), | |
array( | |
'option' => 'my_settings_prefix_calendar_messages_legend_help', | |
'label' => __( 'Show date details legend', 'my-cool-plugin-text-domain' ), | |
'help' => __( 'Explains how to display date details.', 'my-cool-plugin-text-domain' ), | |
'default' => __( 'Right click (or long press on touch screens) on a date to show details.', 'my-cool-plugin-text-domain' ), | |
'force_default' => true, | |
'type' => 'textarea', | |
'input_attrs' => array( | |
'rows' => '1', | |
), | |
), | |
array( | |
'option' => 'my_settings_prefix_calendar_messages_legend_prompt', | |
'label' => __( 'Contact for assistance message', 'my-cool-plugin-text-domain' ), | |
'help' => __( 'Displayed at the bottom of the calendar help tab.', 'my-cool-plugin-text-domain' ), | |
'default' => __( 'Feel free to contact us if you need assistance with availability or booking rules.', 'my-cool-plugin-text-domain' ), | |
'force_default' => true, | |
'type' => 'textarea', | |
'input_attrs' => array( | |
'rows' => '1', | |
), | |
), | |
array( | |
'option' => 'my_settings_prefix_calendar_messages_unknown_error', | |
'label' => __( 'Unknown error', 'my-cool-plugin-text-domain' ), | |
'help' => __( 'Generic error message to display when an unknown error occurred.', 'my-cool-plugin-text-domain' ), | |
'default' => __( 'An error occurred. Please retry or contact us for assistance.', 'my-cool-plugin-text-domain' ), | |
'force_default' => true, | |
'type' => 'textarea', | |
'input_attrs' => array( | |
'rows' => '1', | |
), | |
), | |
array( | |
'option' => 'my_settings_prefix_calendar_messages_clear', | |
'label' => __( 'Clear dates button', 'my-cool-plugin-text-domain' ), | |
'help' => __( 'Clear dates button text.', 'my-cool-plugin-text-domain' ), | |
'default' => __( 'Clear dates', 'my-cool-plugin-text-domain' ), | |
'force_default' => true, | |
'input_attrs' => array( | |
'class' => 'regular-text code', | |
), | |
), | |
array( | |
'option' => 'my_settings_prefix_calendar_messages_help', | |
'label' => __( 'Help button', 'my-cool-plugin-text-domain' ), | |
'help' => __( 'Open calendar help button text.', 'my-cool-plugin-text-domain' ), | |
'default' => __( 'Help', 'my-cool-plugin-text-domain' ), | |
'force_default' => true, | |
'input_attrs' => array( | |
'class' => 'regular-text code', | |
), | |
), | |
), | |
), | |
), | |
), | |
// Display Settings Page | |
array( | |
'slug' => 'display-settings', | |
'parent' => self::SETTINGS_PAGE_SLUG, | |
'position' => 20, | |
'label' => __( 'Display Settings', 'my-cool-plugin-text-domain' ), | |
'title' => __( 'Display Settings', 'my-cool-plugin-text-domain' ), | |
'sections' => array( | |
// Ratings Section | |
array( | |
'id' => 'ratings', | |
'title' => __( 'Ratings', 'my-cool-plugin-text-domain' ), | |
'settings' => array( | |
array( | |
'option' => 'my_settings_prefix_display_ratings_stars_title', | |
'type' => 'text', | |
'label' => __( 'Stars title', 'my-cool-plugin-text-domain' ), | |
'help' => __( 'Displayed next to ratings stars.', 'my-cool-plugin-text-domain' ) . ' ' | |
. sprintf( | |
__( 'Use %1$s for rating, %2$s for best rating, %3$s for total number of reviews and %4$s for property name.', 'my-cool-plugin-text-domain' ), | |
Span::HTML( array( 'class' => 'code' ), '{rating}' ), | |
Span::HTML( array( 'class' => 'code' ), '{outof}' ), | |
Span::HTML( array( 'class' => 'code' ), '{reviews}' ), | |
Span::HTML( array( 'class' => 'code' ), '{name}' ) | |
), | |
'default' => sprintf( | |
__( 'Rated %1$s out of %2$s, based on %3$s reviews.', 'my-cool-plugin-text-domain' ), | |
'{rating}', | |
'{outof}', | |
'{reviews}' | |
), | |
'force_default' => true, | |
'sanitize_callback' => 'sanitize_text_field', | |
'input_attrs' => array( | |
'class' => 'large-text', | |
), | |
), | |
array( | |
'option' => 'my_settings_prefix_display_ratings_stars_description', | |
'type' => 'text', | |
'label' => __( 'Stars description', 'my-cool-plugin-text-domain' ), | |
'help' => __( 'Displayed next to ratings stars on singular vacation rental pages.', 'my-cool-plugin-text-domain' ) . ' ' | |
. sprintf( | |
__( 'Use %1$s for rating, %2$s for best rating, %3$s for total number of reviews and %4$s for property name.', 'my-cool-plugin-text-domain' ), | |
Span::HTML( array( 'class' => 'code' ), '{rating}' ), | |
Span::HTML( array( 'class' => 'code' ), '{outof}' ), | |
Span::HTML( array( 'class' => 'code' ), '{reviews}' ), | |
Span::HTML( array( 'class' => 'code' ), '{name}' ) | |
), | |
'default' => sprintf( | |
__( '%1$s is rated %2$s out of %3$s, based on %4$s reviews from our guests.', 'my-cool-plugin-text-domain' ), | |
'{name}', | |
'{rating}', | |
'{outof}', | |
'{reviews}' | |
), | |
'force_default' => true, | |
'sanitize_callback' => 'sanitize_text_field', | |
'input_attrs' => array( | |
'class' => 'large-text', | |
), | |
), | |
array( | |
'option' => 'my_settings_prefix_display_ratings_stars_description_hide', | |
'type' => 'checkbox', | |
'label' => __( 'Hide stars description', 'my-cool-plugin-text-domain' ), | |
), | |
), | |
), | |
// Summary Section | |
array( | |
'id' => 'property-summary', | |
'title' => __( 'Property summary', 'my-cool-plugin-text-domain' ), | |
'settings' => array( | |
// Hide Property Type | |
array( | |
'option' => 'my_settings_prefix_display_hide_type', | |
'type' => 'checkbox', | |
'label' => __( 'Hide property type', 'my-cool-plugin-text-domain' ), | |
), | |
// Hide Property Surface Area | |
array( | |
'option' => 'my_settings_prefix_display_hide_surface_area', | |
'type' => 'checkbox', | |
'label' => __( 'Hide property surface area', 'my-cool-plugin-text-domain' ), | |
), | |
// Hide Property Floors | |
array( | |
'option' => 'my_settings_prefix_display_hide_floors', | |
'type' => 'checkbox', | |
'label' => __( 'Hide property floors', 'my-cool-plugin-text-domain' ), | |
), | |
// Hide Property Bedrooms | |
array( | |
'option' => 'my_settings_prefix_display_hide_bedrooms', | |
'type' => 'checkbox', | |
'label' => __( 'Hide property bedrooms', 'my-cool-plugin-text-domain' ), | |
), | |
// Hide Property Bathrooms | |
array( | |
'option' => 'my_settings_prefix_display_hide_bathrooms', | |
'type' => 'checkbox', | |
'label' => __( 'Hide property bathrooms', 'my-cool-plugin-text-domain' ), | |
), | |
// Hide Property Half Bathrooms | |
array( | |
'option' => 'my_settings_prefix_display_hide_half_bathrooms', | |
'type' => 'checkbox', | |
'label' => __( 'Hide property half bathrooms', 'my-cool-plugin-text-domain' ), | |
), | |
// Hide Property Sleeps | |
array( | |
'option' => 'my_settings_prefix_display_hide_sleeps', | |
'type' => 'checkbox', | |
'label' => __( 'Hide property sleeps', 'my-cool-plugin-text-domain' ), | |
), | |
// Hide Property Accessible | |
array( | |
'option' => 'my_settings_prefix_display_hide_accessible', | |
'type' => 'checkbox', | |
'label' => __( 'Hide property accessible', 'my-cool-plugin-text-domain' ), | |
), | |
// Hide Property Pet Friendly | |
array( | |
'option' => 'my_settings_prefix_display_hide_pet_friendly', | |
'type' => 'checkbox', | |
'label' => __( 'Hide property pet friendly', 'my-cool-plugin-text-domain' ), | |
), | |
// Hide Property Featured Amenities | |
array( | |
'option' => 'my_settings_prefix_display_hide_featured_amenities', | |
'type' => 'checkbox', | |
'label' => __( 'Hide property featured amenities', 'my-cool-plugin-text-domain' ), | |
), | |
), | |
), | |
// Featured Amenities Section | |
array( | |
'id' => 'featured-amenities', | |
'title' => __( 'Featured Amenities', 'my-cool-plugin-text-domain' ), | |
'settings' => array( | |
// Featured amenities category | |
array( | |
'option' => 'my_settings_prefix_display_featured_amenity_category', | |
'type' => 'select', | |
'label' => __( 'Featured amenities group', 'my-cool-plugin-text-domain' ), | |
'help' => __( 'Please select featured amenities group.', 'my-cool-plugin-text-domain' ), | |
'default' => 0, | |
'sanitize_callback' => 'absint', | |
'data_type' => 'integer', | |
'choices' => Queries::getAmenityGroupChoices(), | |
), | |
// Featured amenities | |
array( | |
'option' => 'my_settings_prefix_display_featured_amenity_ids', | |
'type' => 'checkboxes', # will create a group of checkboxes saved as an array to the database (easier than multiselect for the user) | |
'label' => __( 'Featured amenities', 'my-cool-plugin-text-domain' ), | |
'help' => __( 'Please select amenities to highlight as featured. Make sure the previous option is saved.', 'my-cool-plugin-text-domain' ), | |
'default' => 0, | |
'sanitize_callback' => '\TechSpokes\TrackHospitalitySoftware\Tools\Sanitizers::sanitize_array_of_ids', | |
// when working with checkboxes, the choices must be provided (same format as select), | |
// the choices here depend on the extra conditional check | |
'choices' => ( | |
self::isEmpty( $amenity_group_id = absint( get_option( 'my_settings_prefix_display_featured_amenity_category' ) ) ) ? | |
array() | |
: wp_list_pluck( Queries::getAmenitiesInGroup( $amenity_group_id ), 'ID', 'post_title' ) | |
), | |
), | |
), | |
), | |
// Bedding Details Section | |
array( | |
'id' => 'bedding-details', | |
'title' => __( 'Bedding details', 'my-cool-plugin-text-domain' ), | |
'settings' => array( | |
array( | |
'option' => 'my_settings_prefix_lang_bedding_details_title', | |
'label' => __( 'Bedding details title', 'my-cool-plugin-text-domain' ), | |
'help' => __( 'Text displayed before property bedding details.', 'my-cool-plugin-text-domain' ), | |
'default' => __( 'Bedding details', 'my-cool-plugin-text-domain' ), | |
'force_default' => true, | |
), | |
), | |
), | |
// Description Section | |
array( | |
'id' => 'description', | |
'title' => __( 'Description', 'my-cool-plugin-text-domain' ), | |
'settings' => array( | |
array( | |
'option' => 'my_settings_prefix_display_description_title', | |
'type' => 'text', | |
'label' => __( 'Description title', 'my-cool-plugin-text-domain' ), | |
'help' => __( 'Please enter the title to use for description tab.', 'my-cool-plugin-text-domain' ), | |
'default' => self::getDescriptionTabTitleDefault(), | |
'force_default' => true, | |
'sanitize_callback' => 'sanitize_text_field', | |
'input_attrs' => array( | |
'class' => 'regular-text', | |
'placeholder' => self::getDescriptionTabTitleDefault(), | |
), | |
), | |
array( | |
'option' => 'my_settings_prefix_display_tax_id_hide', | |
'type' => 'checkbox', | |
'label' => __( 'Hide property tax IDs', 'my-cool-plugin-text-domain' ), | |
), | |
array( | |
'option' => 'my_settings_prefix_display_tax_id_label', | |
'type' => 'text', | |
'label' => __( 'Tax ID label', 'my-cool-plugin-text-domain' ), | |
'help' => __( 'If you want to add a label to tax IDs, enter it here.', 'my-cool-plugin-text-domain' ), | |
'default' => '', | |
'force_default' => false, | |
'sanitize_callback' => 'sanitize_text_field', | |
'input_attrs' => array( | |
'class' => 'regular-text', | |
), | |
), | |
), | |
), | |
// Rooms Section | |
array( | |
'id' => 'rooms', | |
'title' => __( 'Rooms', 'my-cool-plugin-text-domain' ), | |
'settings' => array( | |
array( | |
'option' => 'my_settings_prefix_display_rooms_title', | |
'type' => 'text', | |
'label' => __( 'Rooms title', 'my-cool-plugin-text-domain' ), | |
'help' => __( 'Please, enter title for rooms tab.', 'my-cool-plugin-text-domain' ), | |
'default' => __( 'Rooms', 'my-cool-plugin-text-domain' ), | |
'force_default' => true, | |
'sanitize_callback' => 'sanitize_text_field', | |
'input_attrs' => array( | |
'class' => 'regular-text', | |
), | |
), | |
array( | |
'option' => 'my_settings_prefix_display_rooms_hidden_types', | |
'type' => 'checkboxes', | |
'label' => __( 'Hidden room types', 'my-cool-plugin-text-domain' ), | |
'help' => __( 'Check the room types to hide on front end.', 'my-cool-plugin-text-domain' ), | |
'default' => array(), | |
'force_default' => true, | |
'sanitize_callback' => '\TechSpokes\TrackHospitalitySoftware\Tools\Sanitizers::sanitize_array_of_ids', | |
'choices' => Queries::cacheGetSpaceTypeChoices(), | |
), | |
), | |
), | |
// Virtual Tours Section | |
array( | |
'id' => 'virtual-tours', | |
'title' => __( 'Virtual tours', 'my-cool-plugin-text-domain' ), | |
'settings' => array( | |
array( | |
'option' => 'my_settings_prefix_display_virtual_tours_title', | |
'type' => 'text', | |
'label' => __( 'Virtual tours title', 'my-cool-plugin-text-domain' ), | |
'help' => __( 'Please, enter title for virtual tours tab.', 'my-cool-plugin-text-domain' ), | |
'default' => __( 'Virtual tour', 'my-cool-plugin-text-domain' ), | |
'force_default' => true, | |
'sanitize_callback' => 'sanitize_text_field', | |
'input_attrs' => array( | |
'class' => 'regular-text', | |
), | |
), | |
array( | |
'option' => 'my_settings_prefix_display_virtual_tours_meta_fields', | |
'type' => 'text', | |
'label' => __( 'Meta field key', 'my-cool-plugin-text-domain' ), | |
'help' => sprintf( | |
__( 'Virtual tour URL meta field key. Please use %s (pipe symbol) to separate multiple keys.', 'my-cool-plugin-text-domain' ), | |
'<span class="code">|</span>' | |
), | |
// using custom sanitizer as will be sanitizing the pipe separated keys present as a flat string | |
'sanitize_callback' => '\TechSpokes\TrackHospitalitySoftware\Tools\Sanitizers::sanitize_pipe_separated_keys', | |
'input_attrs' => array( | |
'class' => 'widefat', | |
), | |
), | |
), | |
), | |
// Availability Section | |
array( | |
'id' => 'availability', | |
'title' => __( 'Availability and Quote', 'my-cool-plugin-text-domain' ), | |
'settings' => array( | |
array( | |
'option' => 'my_settings_prefix_display_availability_tab_button_label', | |
'type' => 'text', | |
'label' => __( 'Availability and Quote tab button text', 'my-cool-plugin-text-domain' ), | |
'default' => __( 'Check availability', 'my-cool-plugin-text-domain' ), | |
'force_default' => true, | |
), | |
), | |
), | |
// Comments Section | |
array( | |
'id' => 'property-comments', | |
'title' => __( 'Reviews and Comments', 'my-cool-plugin-text-domain' ), | |
'settings' => array( | |
array( | |
'option' => 'my_settings_prefix_display_comments_section_title', | |
'type' => 'text', | |
'label' => __( 'Comments section title', 'my-cool-plugin-text-domain' ), | |
'help' => __( 'Please, enter comments section title. Leave empty to use default. Note: available only in Genesis themes.', 'my-cool-plugin-text-domain' ), | |
'sanitize_callback' => 'sanitize_text_field', | |
'input_attrs' => array( | |
'class' => 'large-text', | |
'placeholder' => __( 'Comments', 'my-cool-plugin-text-domain' ), | |
), | |
), | |
array( | |
'option' => 'my_settings_prefix_display_ratings_form_title', | |
'type' => 'text', | |
'label' => __( 'Review/Comment form title', 'my-cool-plugin-text-domain' ), | |
'help' => __( 'Please, enter review/comment form title. Leave empty to use default.', 'my-cool-plugin-text-domain' ), | |
'sanitize_callback' => 'sanitize_text_field', | |
'input_attrs' => array( | |
'class' => 'large-text', | |
), | |
), | |
array( | |
'option' => 'my_settings_prefix_display_ratings_review_rating_help', | |
'type' => 'textarea', | |
'label' => __( 'Review rating field help', 'my-cool-plugin-text-domain' ), | |
'help' => __( 'Text entered here will be displayed below review rating field when the visitor clicks on stars.', 'my-cool-plugin-text-domain' ), | |
'sanitize_callback' => 'sanitize_text_field', | |
'default' => __( 'Please, make sure you fill in the required fields below.', 'my-cool-plugin-text-domain' ), | |
'force_default' => true, | |
'input_attrs' => array( | |
'class' => 'large-text', | |
'rows' => '3', | |
), | |
), | |
array( | |
'option' => 'my_settings_prefix_display_ratings_review_rating_reset', | |
'type' => 'text', | |
'label' => __( 'Reset rating text', 'my-cool-plugin-text-domain' ), | |
'help' => __( 'Text for reset rating link displayed after the review rating help.', 'my-cool-plugin-text-domain' ), | |
'sanitize_callback' => 'sanitize_text_field', | |
'default' => __( 'Click here to clear the rating.', 'my-cool-plugin-text-domain' ), | |
'force_default' => true, | |
'input_attrs' => array( | |
'class' => 'large-text', | |
), | |
), | |
array( | |
'option' => 'my_settings_prefix_display_ratings_comment_label', | |
'type' => 'text', | |
'label' => __( 'Review/Comment field label', 'my-cool-plugin-text-domain' ), | |
'help' => __( 'Please, enter review/comment field label text. Leave empty to use default.', 'my-cool-plugin-text-domain' ), | |
'sanitize_callback' => 'sanitize_text_field', | |
'input_attrs' => array( | |
'class' => 'large-text', | |
), | |
), | |
array( | |
'option' => 'my_settings_prefix_display_comment_phone_number_label', | |
'type' => 'text', | |
'label' => __( 'Phone number field label', 'my-cool-plugin-text-domain' ), | |
'help' => __( 'Please, enter phone number field label text.', 'my-cool-plugin-text-domain' ), | |
'sanitize_callback' => 'sanitize_text_field', | |
'input_attrs' => array( | |
'class' => 'large-text', | |
), | |
'default' => __( 'Phone number', 'my-cool-plugin-text-domain' ), | |
'force_default' => true, | |
), | |
array( | |
'option' => 'my_settings_prefix_display_comment_phone_number_help', | |
'type' => 'text', | |
'label' => __( 'Phone number help text', 'my-cool-plugin-text-domain' ), | |
'help' => __( 'Please, enter phone number field help text.', 'my-cool-plugin-text-domain' ), | |
'sanitize_callback' => 'sanitize_text_field', | |
'input_attrs' => array( | |
'class' => 'large-text', | |
), | |
'default' => __( 'If you wish to be called back, please enter your phone number.', 'my-cool-plugin-text-domain' ), | |
'force_default' => true, | |
), | |
array( | |
'option' => 'my_settings_prefix_display_ratings_form_submit_label', | |
'type' => 'text', | |
'label' => __( 'Review/Comment form submit', 'my-cool-plugin-text-domain' ), | |
'help' => __( 'Please, enter review/comment form submit button label. Leave empty to use default.', 'my-cool-plugin-text-domain' ), | |
'sanitize_callback' => 'sanitize_text_field', | |
'input_attrs' => array( | |
'class' => 'regular-text', | |
), | |
), | |
), | |
), | |
), | |
), | |
// Quote Settings Page | |
array( | |
'slug' => 'vacation-rentals-quote-settings', | |
'parent' => self::SETTINGS_PAGE_SLUG, | |
'position' => 30, | |
'label' => __( 'Quote Settings', 'my-cool-plugin-text-domain' ), | |
'title' => __( 'Quote Settings', 'my-cool-plugin-text-domain' ), | |
'description' => __( 'Quote settings and configuration.', 'my-cool-plugin-text-domain' ), | |
'sections' => array( | |
array( | |
'id' => 'taxes', | |
'title' => __( 'Taxes', 'my-cool-plugin-text-domain' ), | |
'settings' => array( | |
array( | |
'option' => 'my_settings_prefix_option_quote_taxes_label', | |
'type' => 'text', | |
'label' => __( 'Taxes line label', 'my-cool-plugin-text-domain' ), | |
'help' => __( 'Label for total taxes line in quote details.', 'my-cool-plugin-text-domain' ), | |
'default' => self::getQuoteTaxesLabelDefault(), | |
'force_default' => true, | |
'sanitize_callback' => 'sanitize_text_field', | |
'input_attrs' => array( | |
'class' => 'large-text', | |
'placeholder' => self::getQuoteTaxesLabelDefault(), | |
), | |
), | |
array( | |
'option' => 'my_settings_prefix_option_quote_taxes_label_merged', | |
'type' => 'text', | |
'label' => __( 'Merged taxes line label', 'my-cool-plugin-text-domain' ), | |
'help' => __( 'Label for total taxes line in quote details when taxes are merged into one line.', 'my-cool-plugin-text-domain' ), | |
'default' => self::getQuoteTaxesLabelDefault(), | |
'force_default' => true, | |
'sanitize_callback' => 'sanitize_text_field', | |
'input_attrs' => array( | |
'class' => 'large-text', | |
'placeholder' => self::getQuoteTaxesLabelDefault(), | |
), | |
), | |
array( | |
'option' => 'my_settings_prefix_option_quote_taxes_label', | |
'type' => 'checkbox', | |
'label' => __( 'Merge taxes', 'my-cool-plugin-text-domain' ), | |
'help' => __( 'Merge taxes into one line.', 'my-cool-plugin-text-domain' ), | |
'default' => 0, | |
'force_default' => true, | |
'sanitize_callback' => 'absint', | |
), | |
), | |
), | |
array( | |
'id' => 'required_deposit', | |
'title' => __( 'Required Deposit', 'my-cool-plugin-text-domain' ), | |
'settings' => array( | |
array( | |
'option' => 'my_settings_prefix_lang_required_deposit_description', | |
'type' => 'textarea', | |
'label' => __( 'Required deposit description', 'my-cool-plugin-text-domain' ), | |
'help' => sprintf( | |
__( 'Use %1$s for deposit amount, %2$s for travel insurance cost, %3$s for reservation cost and %4$s for the total cost with travel insurance.', 'my-cool-plugin-text-domain' ), | |
'<strong>{depositAmount}</strong>', | |
'<strong>{insuranceCost}</strong>', | |
'<strong>{reservationCost}</strong>', | |
'<strong>{totalCost}</strong>' | |
), | |
'default' => __( 'A deposit of {depositAmount} is required for booking. If the travel insurance accepted below, an additional amount of {insuranceCost} will be charged along with the initial deposit to cover the insurance cost.', 'my-cool-plugin-text-domain' ), | |
'force_default' => true, | |
'input_attrs' => array( | |
'class' => 'widefat', | |
'rows' => 3, | |
), | |
), | |
array( | |
'option' => 'my_settings_prefix_lang_required_deposit_no_ti', | |
'type' => 'textarea', | |
'label' => __( 'Required deposit without travel insurance', 'my-cool-plugin-text-domain' ), | |
'help' => sprintf( | |
__( 'Use %1$s for deposit amount and %2$s for reservation cost.', 'my-cool-plugin-text-domain' ), | |
'<strong>{depositAmount}</strong>', | |
'<strong>{reservationCost}</strong>' | |
), | |
'default' => __( 'A deposit of {depositAmount} is required for booking.', 'my-cool-plugin-text-domain' ), | |
'force_default' => true, | |
'input_attrs' => array( | |
'class' => 'widefat', | |
'rows' => 3, | |
), | |
), | |
), | |
), | |
array( | |
'id' => 'booking_policy', | |
'title' => __( 'Booking policies', 'my-cool-plugin-text-domain' ), | |
'settings' => array( | |
array( | |
'option' => 'my_settings_prefix_booking_policy_title', | |
'label' => __( 'Booking policies title', 'my-cool-plugin-text-domain' ), | |
'help' => __( 'Booking policies section title.', 'my-cool-plugin-text-domain' ), | |
'default' => __( 'Booking policies', 'my-cool-plugin-text-domain' ), | |
'force_default' => true, | |
'input_attrs' => array( | |
'class' => 'widefat', | |
), | |
), | |
array( | |
'option' => 'my_settings_prefix_booking_policy_intro_text', | |
'label' => __( 'Links introduction text', 'my-cool-plugin-text-domain' ), | |
'help' => __( 'Booking policies introduction text.', 'my-cool-plugin-text-domain' ), | |
'default' => __( 'Please, follow the links below to read the booking policies:', 'my-cool-plugin-text-domain' ), | |
'force_default' => true, | |
'input_attrs' => array( | |
'class' => 'widefat', | |
), | |
), | |
array( | |
'option' => 'my_settings_prefix_booking_policy_agreement_label', | |
'label' => __( 'Booking policies agreement', 'my-cool-plugin-text-domain' ), | |
'help' => __( 'Booking policies agreement checkbox label.', 'my-cool-plugin-text-domain' ), | |
'default' => __( 'I understand and agree with the booking policies above.', 'my-cool-plugin-text-domain' ), | |
'force_default' => true, | |
'input_attrs' => array( | |
'class' => 'widefat', | |
), | |
), | |
), | |
), | |
array( | |
'id' => 'cancellation_policy', | |
'title' => __( 'Cancellation policies', 'my-cool-plugin-text-domain' ), | |
'settings' => array( | |
array( | |
'option' => 'my_settings_prefix_cancellation_policy_title', | |
'label' => __( 'Cancellation policies title', 'my-cool-plugin-text-domain' ), | |
'help' => __( 'Cancellation policies section title.', 'my-cool-plugin-text-domain' ), | |
'default' => __( 'Cancellation policies', 'my-cool-plugin-text-domain' ), | |
'force_default' => true, | |
'input_attrs' => array( | |
'class' => 'widefat', | |
), | |
), | |
array( | |
'option' => 'my_settings_prefix_cancellation_policy_sub_title', | |
'label' => __( 'Cancellation policies sub title', 'my-cool-plugin-text-domain' ), | |
'help' => __( 'Cancellation policies section sub title.', 'my-cool-plugin-text-domain' ), | |
'default' => '', | |
'force_default' => false, | |
'input_attrs' => array( | |
'class' => 'widefat', | |
), | |
), | |
array( | |
'option' => 'my_settings_prefix_cancellation_policy_notice_title', | |
'label' => __( 'Cancellation policies notice title', 'my-cool-plugin-text-domain' ), | |
'help' => __( 'Cancellation policies notice title.', 'my-cool-plugin-text-domain' ), | |
'default' => '', | |
'force_default' => false, | |
'input_attrs' => array( | |
'class' => 'widefat', | |
), | |
), | |
array( | |
'option' => 'my_settings_prefix_cancellation_policy_notice_text', | |
'label' => __( 'Cancellation policies notice text', 'my-cool-plugin-text-domain' ), | |
'help' => __( 'Cancellation policies notice text.', 'my-cool-plugin-text-domain' ), | |
'default' => '', | |
'type' => 'editor',# will create a TinyMCE editor field | |
'force_default' => false, | |
'sanitize_callback' => 'wp_kses_post', | |
), | |
array( | |
'option' => 'my_settings_prefix_cancellation_policy_agreement_label', | |
'label' => __( 'Cancellation policies agreement', 'my-cool-plugin-text-domain' ), | |
'help' => __( 'Cancellation policies agreement checkbox label.', 'my-cool-plugin-text-domain' ), | |
'default' => __( 'I understand and agree with the cancellation policies above.', 'my-cool-plugin-text-domain' ), | |
'force_default' => true, | |
'input_attrs' => array( | |
'class' => 'widefat', | |
), | |
), | |
array( | |
'option' => 'my_settings_prefix_cancellation_policy_date_change_prompt', | |
'label' => __( 'Date change prompt', 'my-cool-plugin-text-domain' ), | |
'help' => sprintf( | |
__( 'Text displayed below cancellation policies table to describe date change rules. %1$s will be replaced with the time and %2$s with the time zone.', 'my-cool-plugin-text-domain' ), | |
'<code>{time}</code>', | |
'<code>{timeZone}</code>' | |
), | |
'default' => __( 'days change effective at {time} {timeZone}.', 'my-cool-plugin-text-domain' ), | |
'force_default' => true, | |
'input_attrs' => array( | |
'class' => 'widefat', | |
), | |
), | |
array( | |
'option' => 'my_settings_prefix_cancellation_policy_hide_penalty', | |
'type' => 'checkbox', | |
'label' => __( 'Do not display penalty column', 'my-cool-plugin-text-domain' ), | |
), | |
array( | |
'option' => 'my_settings_prefix_cancellation_policy_hide_refundable', | |
'type' => 'checkbox', | |
'label' => __( 'Do not display refundable column', 'my-cool-plugin-text-domain' ), | |
), | |
array( | |
'option' => 'my_settings_prefix_cancellation_policy_hide_cancellable', | |
'type' => 'checkbox', | |
'label' => __( 'Do not display cancellable column', 'my-cool-plugin-text-domain' ), | |
), | |
array( | |
'option' => 'my_settings_prefix_cancellation_policy_hide_description', | |
'type' => 'checkbox', | |
'label' => __( 'Do not display description column', 'my-cool-plugin-text-domain' ), | |
), | |
array( | |
'option' => 'my_settings_prefix_cancellation_policy_penalty_use_description', | |
'type' => 'checkbox', | |
'label' => __( 'Use description if penalty is empty', 'my-cool-plugin-text-domain' ), | |
), | |
), | |
), | |
array( | |
'id' => 'travel_insurance', | |
'title' => __( 'Travel Insurance', 'my-cool-plugin-text-domain' ), | |
'settings' => array( | |
array( | |
'option' => 'my_settings_prefix_quote_travel_insurance_title', | |
'label' => __( 'Travel insurance title', 'my-cool-plugin-text-domain' ), | |
'help' => __( 'Title for travel insurance section', 'my-cool-plugin-text-domain' ), | |
'default' => __( 'Travel insurance', 'my-cool-plugin-text-domain' ), | |
'force_default' => true, | |
'input_attrs' => array( | |
'class' => 'widefat', | |
), | |
), | |
array( | |
'option' => 'my_settings_prefix_quote_travel_insurance_description', | |
'type' => 'textarea', | |
'label' => __( 'Travel insurance description', 'my-cool-plugin-text-domain' ), | |
'help' => sprintf( | |
__( 'Use %1$s for travel insurance cost, %2$s for reservation cost and %3$s for the total cost with travel insurance.', 'my-cool-plugin-text-domain' ), | |
'<strong>{insuranceCost}</strong>', | |
'<strong>{reservationCost}</strong>', | |
'<strong>{totalCost}</strong>' | |
), | |
'default' => __( 'At the next screen, you may also opt in for a travel insurance at additional amount of {insuranceCost} to protect your accommodation investment in the event that any unforeseen circumstances would cause you to cancel and loose the full amount paid.', 'my-cool-plugin-text-domain' ), | |
'force_default' => true, | |
'input_attrs' => array( | |
'class' => 'widefat', | |
'rows' => 3, | |
), | |
), | |
array( | |
'option' => 'my_settings_prefix_quote_travel_insurance_item', | |
'label' => __( 'Travel insurance item', 'my-cool-plugin-text-domain' ), | |
'help' => __( 'Travel insurance item label.', 'my-cool-plugin-text-domain' ), | |
'default' => __( 'Travel insurance (optional)', 'my-cool-plugin-text-domain' ), | |
'force_default' => true, | |
'input_attrs' => array( | |
'class' => 'widefat', | |
), | |
), | |
array( | |
'option' => 'my_settings_prefix_quote_travel_insurance_total', | |
'label' => __( 'Total with travel insurance', 'my-cool-plugin-text-domain' ), | |
'help' => __( 'Total with travel insurance label.', 'my-cool-plugin-text-domain' ), | |
'default' => __( 'Total with travel insurance', 'my-cool-plugin-text-domain' ), | |
'force_default' => true, | |
'input_attrs' => array( | |
'class' => 'widefat', | |
), | |
), | |
), | |
), | |
array( | |
'id' => 'continue_booking', | |
'title' => __( 'Continue Booking', 'my-cool-plugin-text-domain' ), | |
'settings' => array( | |
array( | |
'option' => 'my_settings_prefix_quote_booking_title', | |
'label' => __( 'Continue booking title', 'my-cool-plugin-text-domain' ), | |
'help' => __( 'Title for continue booking section.', 'my-cool-plugin-text-domain' ), | |
'default' => __( 'Continue booking', 'my-cool-plugin-text-domain' ), | |
'force_default' => false, | |
'input_attrs' => array( | |
'class' => 'widefat', | |
), | |
), | |
array( | |
'option' => 'my_settings_prefix_quote_booking_label', | |
'label' => __( 'Continue booking button', 'my-cool-plugin-text-domain' ), | |
'help' => __( 'Label for Continue booking button.', 'my-cool-plugin-text-domain' ), | |
'default' => __( 'Continue booking', 'my-cool-plugin-text-domain' ), | |
'force_default' => true, | |
'input_attrs' => array( | |
'class' => 'widefat', | |
), | |
), | |
), | |
), | |
), | |
), | |
// Analytics Settings Page | |
array( | |
'slug' => 'analytics', | |
'parent' => self::SETTINGS_PAGE_SLUG, | |
'position' => 40, | |
'label' => __( 'Analytics', 'my-cool-plugin-text-domain' ), | |
'title' => __( 'Analytics settings', 'my-cool-plugin-text-domain' ), | |
'sections' => array( | |
array( | |
'id' => 'gtm', | |
'title' => __( 'Google Tag Manager', 'my-cool-plugin-text-domain' ), | |
'description' => __( 'Here you may add Google Tag Manager scripts to be used on your website.', 'my-cool-plugin-text-domain' ), | |
'settings' => array( | |
array( | |
'option' => DataLayer::GTM_HEAD_SCRIPT,# string from the DataLayer class | |
'label' => __( 'Head', 'my-cool-plugin-text-domain' ), | |
'help' => sprintf( | |
__( 'Paste here the code provided by Google Tag Manager to place in %s section of your website pages.', 'my-cool-plugin-text-domain' ), | |
'<b><head></b>' | |
), | |
'type' => 'code', # code editing sanitized textarea field | |
'input_attrs' => array( | |
'rows' => 8, | |
), | |
// custom sanitizer to handle the specific html we are looking for (gets the inner content of script tag, skip the noscript tag) | |
'sanitize_callback' => '\TechSpokes\TrackHospitalitySoftware\Tools\Sanitizers::sanitize_textarea_bare_script', | |
), | |
array( | |
'option' => DataLayer::GTM_BODY_SCRIPT, # string from the DataLayer class | |
'label' => __( 'Body', 'my-cool-plugin-text-domain' ), | |
'help' => sprintf( | |
__( 'Paste here the code provided by Google Tag Manager to place right after the opening %s tag of your website pages.', 'my-cool-plugin-text-domain' ), | |
'<b><body></b>' | |
), | |
'type' => 'code', | |
'input_attrs' => array( | |
'rows' => 8, | |
), | |
// custom sanitizer to handle the specific html we are looking for allows only the noscript and iframe tags from the code given by google | |
'sanitize_callback' => '\TechSpokes\TrackHospitalitySoftware\Tools\Sanitizers::sanitize_textarea_noscript_iframe', | |
), | |
array( | |
'option' => DataLayer::DISABLE_EC_TRACKING, # string from the DataLayer class | |
'type' => 'checkbox', | |
'label' => __( 'Disable enhanced ecommerce', 'my-cool-plugin-text-domain' ), | |
), | |
), | |
), | |
), | |
), | |
// Notifications Settings Page | |
array( | |
'slug' => 'vacation-rentals-notifications', | |
'parent' => self::SETTINGS_PAGE_SLUG, | |
'position' => 50, | |
'label' => __( 'Notifications', 'my-cool-plugin-text-domain' ), | |
'title' => __( 'Notifications', 'my-cool-plugin-text-domain' ), | |
'sections' => array( | |
array( | |
'id' => 'system-comments', | |
'title' => __( 'System commenter', 'my-cool-plugin-text-domain' ), | |
'settings' => array( | |
array( | |
'option' => 'my_settings_prefix_system_commenter_name', | |
'label' => __( 'System commenter name', 'my-cool-plugin-text-domain' ), | |
'help' => __( 'Used as comment author name for system generated comments.', 'my-cool-plugin-text-domain' ), | |
'default' => Comments::get_system_commenter_name_default(), | |
'force_default' => true, | |
), | |
array( | |
'option' => 'my_settings_prefix_system_commenter_email', | |
'label' => __( 'System commenter email', 'my-cool-plugin-text-domain' ), | |
'help' => __( 'Used as comment author email for system generated comments.', 'my-cool-plugin-text-domain' ), | |
'default' => Comments::get_system_commenter_email_default(), | |
'force_default' => true, | |
), | |
), | |
), | |
array( | |
'id' => 'comment-notifications', | |
'title' => __( 'Comment notifications', 'my-cool-plugin-text-domain' ), | |
'settings' => array( | |
array( | |
'option' => 'my_settings_prefix_unit_comment_notification_emails', | |
'label' => __( 'Unit comments', 'my-cool-plugin-text-domain' ), | |
'help' => __( 'Comma separated list of email addresses to send notifications and moderation requests for comments on units.', 'my-cool-plugin-text-domain' ), | |
'sanitize_callback' => array( | |
'\TechSpokes\TrackHospitalitySoftware\Tools\Sanitizers', | |
'sanitize_comma_separated_emails', | |
), | |
'input_attrs' => array( | |
'class' => 'widefat', | |
), | |
), | |
array( | |
'option' => 'my_settings_prefix_reservation_comment_notification_emails', | |
'label' => __( 'Reservation comments', 'my-cool-plugin-text-domain' ), | |
'help' => __( 'Comma separated list of email addresses to send notifications and moderation requests for comments on reservations.', 'my-cool-plugin-text-domain' ), | |
'sanitize_callback' => array( | |
'\TechSpokes\TrackHospitalitySoftware\Tools\Sanitizers', | |
'sanitize_comma_separated_emails', | |
), | |
'input_attrs' => array( | |
'class' => 'widefat', | |
), | |
), | |
), | |
), | |
), | |
), | |
// URL Structure Settings Page | |
array( | |
'slug' => 'vacation-rentals-urls', | |
'parent' => self::SETTINGS_PAGE_SLUG, | |
'position' => 60, | |
'label' => __( 'URL Structure', 'my-cool-plugin-text-domain' ), | |
'title' => __( 'Vacation Rentals URL Settings', 'my-cool-plugin-text-domain' ), | |
'sections' => array( | |
array( | |
'settings' => array( | |
array( | |
'option' => 'my_settings_prefix_vacation_rental_slug', | |
'label' => __( 'Vacation rentals URLs', 'my-cool-plugin-text-domain' ), | |
'help' => sprintf( | |
'%1$s%2$s/%3$s/', | |
esc_url( trailingslashit( get_bloginfo( 'url' ) ) ), | |
sprintf( '<strong>%1$s</strong>', VacationRental::slug() ), | |
sanitize_title_with_dashes( __( 'example-vacation-rental', 'my-cool-plugin-text-domain' ) ) | |
), | |
'default' => VacationRental::pluralName(), | |
'force_default' => true, | |
'sanitize_callback' => 'sanitize_key', | |
), | |
array( | |
'option' => 'my_settings_prefix_tax_slug_company', | |
'label' => __( 'Company URLs', 'my-cool-plugin-text-domain' ), | |
'help' => sprintf( | |
'%1$s%2$s/%3$s/', | |
esc_url( trailingslashit( get_bloginfo( 'url' ) ) ), | |
sprintf( '<strong>%1$s</strong>', Company::slug() ), | |
sanitize_title_with_dashes( __( 'example-company', 'my-cool-plugin-text-domain' ) ) | |
), | |
'default' => Company::SLUG, # string from Company class | |
'force_default' => true, | |
'sanitize_callback' => 'sanitize_key', | |
), | |
array( | |
'option' => 'my_settings_prefix_tax_slug_area', | |
'label' => __( 'Area URLs', 'my-cool-plugin-text-domain' ), | |
'help' => sprintf( | |
'%1$s%2$s/%3$s/', | |
esc_url( trailingslashit( get_bloginfo( 'url' ) ) ), | |
sprintf( '<strong>%1$s</strong>', Area::slug() ), | |
sanitize_title_with_dashes( __( 'example-area', 'my-cool-plugin-text-domain' ) ) | |
), | |
'default' => Area::SLUG, # string from Area class | |
'force_default' => true, | |
'sanitize_callback' => 'sanitize_key', | |
), | |
array( | |
'option' => 'my_settings_prefix_tax_slug_complex', | |
'label' => __( 'Complex URLs', 'my-cool-plugin-text-domain' ), | |
'help' => sprintf( | |
'%1$s%2$s/%3$s/', | |
esc_url( trailingslashit( get_bloginfo( 'url' ) ) ), | |
sprintf( '<strong>%1$s</strong>', Complex::slug() ), | |
sanitize_title_with_dashes( __( 'example-complex', 'my-cool-plugin-text-domain' ) ) | |
), | |
'default' => Complex::SLUG, # string from Complex class | |
'force_default' => true, | |
'sanitize_callback' => 'sanitize_key', | |
), | |
array( | |
'option' => 'my_settings_prefix_tax_slug_collection', | |
'label' => __( 'Collection URLs', 'my-cool-plugin-text-domain' ), | |
'help' => sprintf( | |
'%1$s%2$s/%3$s/', | |
esc_url( trailingslashit( get_bloginfo( 'url' ) ) ), | |
sprintf( '<strong>%1$s</strong>', Collection::slug() ), | |
sanitize_title_with_dashes( __( 'example-collection', 'my-cool-plugin-text-domain' ) ) | |
), | |
'default' => Collection::SLUG, # string from Collection class | |
'force_default' => true, | |
'sanitize_callback' => 'sanitize_key', | |
), | |
array( | |
'option' => 'my_settings_prefix_tax_slug_location_type', | |
'label' => __( 'Location URLs', 'my-cool-plugin-text-domain' ), | |
'help' => sprintf( | |
'%1$s%2$s/%3$s/', | |
esc_url( trailingslashit( get_bloginfo( 'url' ) ) ), | |
sprintf( '<strong>%1$s</strong>', LocationType::slug() ), | |
sanitize_title_with_dashes( __( 'example-location', 'my-cool-plugin-text-domain' ) ) | |
), | |
'default' => LocationType::SLUG, # string from LocationType class | |
'force_default' => true, | |
'sanitize_callback' => 'sanitize_key', | |
), | |
array( | |
'option' => 'my_settings_prefix_tax_slug_property_type', | |
'label' => __( 'Type URLs', 'my-cool-plugin-text-domain' ), | |
'help' => sprintf( | |
'%1$s%2$s/%3$s/', | |
esc_url( trailingslashit( get_bloginfo( 'url' ) ) ), | |
sprintf( '<strong>%1$s</strong>', PropertyType::slug() ), | |
sanitize_title_with_dashes( __( 'example-type', 'my-cool-plugin-text-domain' ) ) | |
), | |
'default' => PropertyType::SLUG, # string from PropertyType class | |
'force_default' => true, | |
'sanitize_callback' => 'sanitize_key', | |
), | |
array( | |
'option' => 'my_settings_prefix_reservation_slug', | |
'label' => __( 'Reservations URLs', 'my-cool-plugin-text-domain' ), | |
'help' => sprintf( | |
'%1$s%2$s/%3$s/', | |
esc_url( trailingslashit( get_bloginfo( 'url' ) ) ), | |
sprintf( '<strong>%1$s</strong>', Reservation::URL_PREFIX ), | |
sanitize_title_with_dashes( __( 'example-reservation', 'my-cool-plugin-text-domain' ) ) | |
), | |
'default' => Reservation::URL_PREFIX, # string from Reservation class | |
'force_default' => true, | |
'sanitize_callback' => 'sanitize_key', | |
), | |
), | |
), | |
), | |
), | |
// Amenity Settings: | |
// Amenity Display Settings Page | |
array( | |
'slug' => 'amenities-settings', | |
'label' => __( 'Display Settings', 'my-cool-plugin-text-domain' ), | |
'title' => __( 'Display Settings', 'my-cool-plugin-text-domain' ), | |
'parent' => sprintf( 'edit.php?post_type=%1$s', Amenity::POST_TYPE ), | |
'sections' => array( | |
array( | |
'id' => 'groups_order', | |
'title' => __( 'Amenity groups', 'my-cool-plugin-text-domain' ), | |
'settings' => array( | |
array( | |
'option' => 'amenity_groups_order', | |
'type' => Setting::NOT_OPTION, # will skip registration of the option in WP, we handle it on our own via ajax from the scripts loaded on the page | |
'label' => __( 'Amenities groups order', 'my-cool-plugin-text-domain' ), | |
'help' => __( 'Drag groups to sort them in desired display order. Notice: this setting updates immediately.', 'my-cool-plugin-text-domain' ), | |
// define the callback to display the field (as we are not using the default callback) | |
'display_callback' => '\TechSpokes\TrackHospitalitySoftware\Admin\AmenitiesGroupsSortableOptionField::doField', | |
), | |
), | |
), | |
), | |
// adding scripts to the current page the Page class from WPSettings wil take care of registering them and enqueueing them | |
'scripts' => array( | |
// the 1st script, may be added more if needed | |
array( | |
'handle' => 'amenity-groups-sortable-field', | |
// MY_COOL_PLUGIN_INCLUDES_URL is defined in the main plugin file | |
'src' => Scripts::maybeMinify( MY_COOL_PLUGIN_INCLUDES_URL . 'js/admin/amenity-groups-sortable-field.js' ), | |
#Scripts::maybeMinify( $url ) - inserts .min into file url if SCRIPT_DEBUG is false | |
'deps' => array( | |
'jquery-ui-sortable', | |
), | |
'ver' => null,# or '1.0.0' | |
'in_footer' => true, | |
), | |
), | |
// adding styles to the current page, the Page class from WPSettings wil take care of registering them and enqueueing them | |
'styles' => array( | |
// the 1st style, may be added more if needed | |
array( | |
'handle' => 'amenity-groups-sortable-styles', | |
// MY_COOL_PLUGIN_INCLUDES_URL is defined in the main plugin file | |
'src' => Scripts::maybeMinify( MY_COOL_PLUGIN_INCLUDES_URL . 'css/admin/amenity-groups-sortable-field.css' ), | |
#Scripts::maybeMinify( $url ) - inserts .min into file url if SCRIPT_DEBUG is false | |
'deps' => array(),# or '1.0.0' | |
'media' => 'all', | |
), | |
), | |
), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment