# post-carousel/2.2.10/admin/views/sp-framework/functions/customize.php

Smart Post – Post Grid, Post Carousel, Post Slider Gutenberg Blocks for Blog &amp; News, version 2.2.10. 117 lines.

- Page: https://pluginprobe.com/plugins/post-carousel/2.2.10/code/admin/views/sp-framework/functions/customize.php
- Raw: https://pluginprobe.com/plugins/post-carousel/2.2.10/raw/admin/views/sp-framework/functions/customize.php
- Modified: 2021-06-04T12:58:50+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/post-carousel/2.2.10/code/admin/views/sp-framework/functions/customize.php#L10-L20`.

```php
<?php if ( ! defined( 'ABSPATH' ) ) {
	die;
} // Cannot access directly.
/**
 *
 * WP Customize custom panel
 *
 * @since 1.0.0
 * @version 1.0.0
 */
if ( ! class_exists( 'WP_Customize_Panel_SP_PC' ) && class_exists( 'WP_Customize_Panel' ) ) {
	class WP_Customize_Panel_SP_PC extends WP_Customize_Panel {

		public $type = 'spf';
	}
}

/**
 *
 * WP Customize custom section
 *
 * @since 1.0.0
 * @version 1.0.0
 */
if ( ! class_exists( 'WP_Customize_Section_SP_PC' ) && class_exists( 'WP_Customize_Section' ) ) {
	class WP_Customize_Section_SP_PC extends WP_Customize_Section {

		public $type = 'spf';
	}
}

/**
 *
 * WP Customize custom control
 *
 * @since 1.0.0
 * @version 1.0.0
 */
if ( ! class_exists( 'WP_Customize_Control_SP_PC' ) && class_exists( 'WP_Customize_Control' ) ) {
	class WP_Customize_Control_SP_PC extends WP_Customize_Control {


		public $type   = 'spf';
		public $field  = '';
		public $unique = '';

		protected function render() {

			$depend = '';
			$hidden = '';

			if ( ! empty( $this->field['dependency'] ) ) {
				   $hidden   = ' spf-dependency-control hidden';
				$depend     .= ' data-controller="' . $this->field['dependency'][0] . '"';
				   $depend  .= ' data-condition="' . $this->field['dependency'][1] . '"';
					$depend .= ' data-value="' . $this->field['dependency'][2] . '"';
			}

			$id    = 'customize-control-' . str_replace( array( '[', ']' ), array( '-', '' ), $this->id );
			$class = 'customize-control customize-control-' . $this->type . $hidden;

			echo '<li id="' . $id . '" class="' . $class . '"' . $depend . '>';
			$this->render_content();
			echo '</li>';

		}

		public function render_content() {

			$complex = array(
				'accordion',
				'background',
				'backup',
				'border',
				'button_set',
				'checkbox',
				'color_group',
				'date',
				'dimensions',
				'fieldset',
				'group',
				'image_select',
				'link_color',
				'media',
				'palette',
				'sortable',
				'sorter',
				'switcher',
				'tabbed',
				'typography',
			);

			$field_id   = ( ! empty( $this->field['id'] ) ) ? $this->field['id'] : '';
			$custom     = ( ! empty( $this->field['customizer'] ) ) ? true : false;
			$is_complex = ( in_array( $this->field['type'], $complex ) ) ? true : false;
			$class      = ( $is_complex || $custom ) ? ' spf-customize-complex' : '';
			$atts       = ( $is_complex || $custom ) ? ' data-unique-id="' . $this->unique . '" data-option-id="' . $field_id . '"' : '';

			if ( ! $is_complex && ! $custom ) {
				  $this->field['attributes']['data-customize-setting-link'] = $this->settings['default']->id;
			}

			$this->field['name'] = $this->settings['default']->id;

			$this->field['dependency'] = array();

			echo '<div class="spf-customize-field' . $class . '"' . $atts . '>';

			SP_PC::field( $this->field, $this->value(), $this->unique, 'customize' );

			echo '</div>';

		}

	}
}

```
