/public/wp-content/plugins/events-calendar-pro/src/Tribe/Customizer/Section_General_Theme.php
PHP | 116 lines | 76 code | 11 blank | 29 comment | 2 complexity | fa30857dd773c50c9dde57e691f3e546 MD5 | raw file
- <?php
- // Don't load directly.
- if ( ! defined( 'ABSPATH' ) ) {
- die( '-1' );
- }
- /**
- * The Events Calendar Customizer Section Class
- * General Theme
- *
- * @package Events Pro
- * @subpackage Customizer
- * @since 4.0
- */
- final class Tribe__Events__Pro__Customizer__Section_General_Theme extends Tribe__Events__Pro__Customizer__Section {
- /**
- * PHP 5.2 method of creating "instances" of an abstract require this
- *
- * Note: This is the only required method for a Connector to work
- *
- * @return self The dynamic instance of this Class
- */
- public static function instance( $name = null ) {
- return parent::instance( __CLASS__ );
- }
- /**
- * Grab the CSS rules template
- *
- * @return string
- */
- public function get_css_template( $template ) {
- $customizer = Tribe__Events__Pro__Customizer__Main::instance();
- if ( $customizer->has_option( $this->ID, 'accent_color' ) ) {
- $template .= '
- .tribe-events-calendar td.tribe-events-present div[id*="tribe-events-daynum-"],
- #tribe_events_filters_wrapper input[type=submit],
- .tribe-events-button,
- #tribe-events .tribe-events-button,
- .tribe-events-button.tribe-inactive,
- #tribe-events .tribe-events-button:hover,
- .tribe-events-button:hover,
- .tribe-events-button.tribe-active:hover {
- background-color: <%= general_theme.accent_color %>;
- }
- #tribe-events-content .tribe-events-tooltip h4,
- #tribe_events_filters_wrapper .tribe_events_slider_val,
- .single-tribe_events a.tribe-events-ical,
- .single-tribe_events a.tribe-events-gcal {
- color: <%= general_theme.accent_color %>;
- }
- .tribe-grid-allday .tribe-events-week-allday-single,
- .tribe-grid-body .tribe-events-week-hourly-single,
- .tribe-grid-allday .tribe-events-week-allday-single:hover,
- .tribe-grid-body .tribe-events-week-hourly-single:hover {
- background-color: <%= general_theme.accent_color %>;
- border-color: rgba(0, 0, 0, 0.3);
- }
- ';
- }
- return $template;
- }
- public function setup() {
- $this->defaults = array(
- 'base_color_scheme' => 'light',
- 'accent_color' => '#21759b',
- );
- $this->arguments = array(
- 'priority' => 10,
- 'capability' => 'edit_theme_options',
- 'title' => esc_html__( 'General Theme', 'tribe-events-calendar-pro' ),
- 'description' => esc_html__( 'Global configurations for the styling of The Events Calendar', 'tribe-events-calendar-pro' ),
- );
- }
- /**
- * Create the Fields/Settings for this sections
- *
- * @param WP_Customize_Section $section The WordPress section instance
- * @param WP_Customize_Manager $manager [description]
- *
- * @return void
- */
- public function register_settings( WP_Customize_Section $section, WP_Customize_Manager $manager ) {
- $customizer = Tribe__Events__Pro__Customizer__Main::instance();
- $manager->add_setting(
- $customizer->get_setting_name( 'accent_color', $section ),
- array(
- 'default' => $this->get_default( 'accent_color' ),
- 'type' => 'option',
- 'sanitize_callback' => 'sanitize_hex_color',
- 'sanitize_js_callback' => 'maybe_hash_hex_color',
- )
- );
- $manager->add_control(
- new WP_Customize_Color_Control(
- $manager,
- $customizer->get_setting_name( 'accent_color', $section ),
- array(
- 'label' => esc_html__( 'Accent Color', 'tribe-events-calendar-pro' ),
- 'section' => $section->id,
- )
- )
- );
- }
- }