Custom map elements, remove elements Join KC discussion

Since version 2.5 Since version 2.5, you can change any element's maps via the filter "kc_add_map".

Instruction:

// Add in your theme file: functions.php 

add_filter('kc_add_map', 'my_add_map_filter', 0 /*priority index*/ , 2 /*number of params*/ );

function my_add_map_filter( $atts, $base ){
	
    if( $base == 'kc_column' ){
        $atts['name'] = 'My custom column';
    }

    return $atts; // required

}

Example: remove elements

add_filter('kc_add_map', 'my_add_map_filter', 1 , 2 );

function my_add_map_filter( $atts, $base ){
	
    if( in_array( $base, array( 'kc_icon', 'kc_button' ) ) ){
        return null;
    }

    return $atts; // required

}

Example: custom styling options for column

add_filter('kc_add_map', 'my_add_map_filter', 0 , 2 );

function my_add_map_filter( $atts, $base ){
	
	if( $base == 'kc_column' ){
		
		$css_map = array(
			
			array(
				
				'screens' => "any",
				'Typography' => array(
					array('property' => 'color', 'label' => 'Color'),
					array('property' => 'font-size', 'label' => 'Font Size'),
					array('property' => 'font-weight', 'label' => 'Font Weight'),
					array('property' => 'font-style', 'label' => 'Font Style'),
					array('property' => 'font-family', 'label' => 'Font Family'),
					array('property' => 'text-align', 'label' => 'Text Align'),
					array('property' => 'text-shadow', 'label' => 'Text Shadow'),
					array('property' => 'text-transform', 'label' => 'Text Transform'),
					array('property' => 'text-decoration', 'label' => 'Text Decoration'),
					array('property' => 'line-height', 'label' => 'Line Height'),
					array('property' => 'letter-spacing', 'label' => 'Letter Spacing'),
					array('property' => 'overflow', 'label' => 'Overflow'),
					array('property' => 'word-break', 'label' => 'Word Break'),					
				),

				//Background group
				'Background' => array(
					array('property' => 'background'),
				),

				//Box group
				'Box' => array(
					array('property' => 'margin', 'label' => 'Margin'),
					array('property' => 'padding', 'label' => 'Padding'),
					array('property' => 'border', 'label' => 'Border'),
					array('property' => 'width', 'label' => 'Width'),
					array('property' => 'height', 'label' => 'Height'),
					array('property' => 'border-radius', 'label' => 'Border Radius'),
					array('property' => 'float', 'label' => 'Float'),
					array('property' => 'display', 'label' => 'Display'),
					array('property' => 'box-shadow', 'label' => 'Box Shadow'),
					array('property' => 'opacity', 'label' => 'Opacity'),
				),
				
				//Custom code css
				'Custom' => array(
					array('property' => 'custom', 'label' => 'Custom CSS')
				)
			),
			array(
				"screens" => "1024,999,767,479",
				'Typography' => array(
					array('property' => 'font-size', 'label' => 'Font Size'),
					array('property' => 'text-align', 'label' => 'Text Align'),
					array('property' => 'line-height', 'label' => 'Line Height'),
					array('property' => 'word-break', 'label' => 'Word Break'),
					array('property' => 'custom', 'label' => 'Custom CSS')
				),

				//Background group
				'Background' => array(
					array('property' => 'background'),
				),

				//Box group
				'Box' => array(
					array('property' => 'width', 'label' => 'Width'),
					array('property' => 'margin', 'label' => 'Margin'),
					array('property' => 'padding', 'label' => 'Padding'),
					array('property' => 'border', 'label' => 'Border'),
					array('property' => 'height', 'label' => 'Height'),
					array('property' => 'border-radius', 'label' => 'Border Radius'),
					array('property' => 'float', 'label' => 'Float'),
					array('property' => 'display', 'label' => 'Display'),
				),
			)
		);
		
		if( isset( $atts['params']['styling'][0] ) )
			$atts['params']['styling'][0]['options'] = $css_map;
		
	}
	
	return $atts;
	
}