Domain: antoinekatan.com
Server Adress: 10.127.20.23
privdayz.com
<?php
namespace QuartCore\CPT\Shortcodes\Awards;
use QuartCore\Lib;
class Awards implements Lib\ShortcodeInterface {
private $base;
function __construct() {
$this->base = 'mkdf_awards';
add_action( 'vc_before_init', array( $this, 'vcMap' ) );
}
public function getBase() {
return $this->base;
}
public function vcMap() {
if ( function_exists( 'vc_map' ) ) {
vc_map(
array(
'name' => esc_html__( 'Awards', 'quart-core' ),
'base' => $this->base,
'category' => esc_html__( 'by QUART', 'quart-core' ),
'icon' => 'icon-wpb-awards extended-custom-icon',
'allowed_container_element' => 'vc_row',
'params' => array(
array(
'type' => 'textfield',
'param_name' => 'custom_class',
'heading' => esc_html__( 'Custom CSS Class', 'quart-core' ),
'description' => esc_html__( 'Style particular content element differently - add a class name and refer to it in custom CSS', 'quart-core' )
),
array(
'type' => 'textfield',
'param_name' => 'year',
'heading' => esc_html__( 'Year', 'quart-core' ),
'description' => esc_html__( 'Enter awards section year', 'quart-core' )
),
array(
'type' => 'colorpicker',
'param_name' => 'year_styles',
'heading' => esc_html__( 'Year Color', 'quart-core' )
),
array(
'type' => 'textfield',
'param_name' => 'title',
'heading' => esc_html__( 'Title', 'quart-core' ),
'description' => esc_html__( 'Enter awards section title', 'quart-core' )
),
array(
'type' => 'colorpicker',
'param_name' => 'title_styles',
'heading' => esc_html__( 'Title Color', 'quart-core' )
),
array(
'type' => 'textfield',
'param_name' => 'text',
'heading' => esc_html__( 'Text', 'quart-core' )
),
array(
'type' => 'colorpicker',
'param_name' => 'items_styles',
'heading' => esc_html__( 'Text Color', 'quart-core' )
),
)
)
);
}
}
public function render( $atts, $content = null ) {
$default_atts = array(
'custom_class' => '',
'year' => '',
'title' => '',
'year_styles' => '',
'title_styles' => '',
'items_styles' => '',
'text' => '',
);
$params = shortcode_atts( $default_atts, $atts );
$params['holder_classes'] = $this->getHolderClasses($params);
$params['separator_styles'] = $this->getSeparatorStyles($params);
$params['title_styles'] = $this->getTitleStyles($params);
$params['year_styles'] = $this->getYearStyles($params);
$params['items_styles'] = $this->getItemsStyles($params);
$output = quart_core_get_shortcode_module_template_part( 'templates/awards-template', 'awards', '', $params );
return $output;
}
private function getHolderClasses( $params ) {
$holderClasses = array( 'mkdf-awards' );
$holderClasses[] = ! empty( $params['custom_class'] ) ? esc_attr( $params['custom_class'] ) : '';
return implode( ' ', $holderClasses );
}
private function getTitleStyles( $params ) {
$styles = array();
if ( ! empty( $params['title_styles'] ) ) {
$styles[] = 'color: ' . $params['title_styles'];
}
return $styles;
}
private function getYearStyles( $params ) {
$styles = array();
if ( ! empty( $params['year_styles'] ) ) {
$styles[] = 'color: ' . $params['year_styles'];
}
return $styles;
}
private function getItemsStyles( $params ) {
$styles = array();
if ( ! empty( $params['items_styles'] ) ) {
$styles[] = 'color: ' . $params['items_styles'];
}
return $styles;
}
private function getSeparatorStyles( $params ) {
$styles = array();
if ( ! empty( $params['title_styles'] ) ) {
$styles[] = 'background-color: ' . $params['title_styles'];
}
return $styles;
}
}
