'', 'id' => '', 'color' => $fusion_settings->get( 'primary_color' ), 'rounded' => 'no', ), $args ); extract( $defaults ); $this->args = $defaults; return '' . do_shortcode( $content ) . ''; } /** * Builds the attributes array. * * @access public * @since 1.0 * @return array */ public function attr() { $attr = array( 'class' => 'fusion-highlight', ); $brightness_level = Fusion_Color::new_color( $this->args['color'] )->brightness; $attr['class'] .= ( $brightness_level > 140 ) ? ' light' : ' dark'; if ( $this->args['class'] ) { $attr['class'] .= ' ' . $this->args['class']; } if ( 'yes' == $this->args['rounded'] ) { $attr['class'] .= ' rounded'; } if ( $this->args['id'] ) { $attr['id'] = $this->args['id']; } if ( 'black' == $this->args['color'] ) { $attr['class'] .= ' highlight2'; } else { $attr['class'] .= ' highlight1'; } $attr['style'] = 'background-color:' . $this->args['color'] . ';'; return $attr; } } } new FusionSC_Highlight(); } /** * Map shortcode to Fusion Builder * * @since 1.0 */ function fusion_element_highlight() { fusion_builder_map( array( 'name' => esc_attr__( 'Highlight', 'fusion-builder' ), 'shortcode' => 'fusion_highlight', 'icon' => 'fusiona-H', 'generator_only' => true, 'params' => array( array( 'type' => 'colorpickeralpha', 'heading' => esc_attr__( 'Highlight Color', 'fusion-builder' ), 'description' => esc_attr__( 'Pick a highlight color.', 'fusion-builder' ), 'param_name' => 'color', 'value' => '', ), array( 'type' => 'select', 'heading' => esc_attr__( 'Highlight With Round Edges', 'fusion-builder' ), 'description' => esc_attr__( 'Choose to have rounded edges.', 'fusion-builder' ), 'param_name' => 'rounded', 'value' => array( 'no' => __( 'No', 'fusion-builder' ), 'yes' => __( 'Yes', 'fusion-builder' ), ), 'default' => 'no', ), array( 'type' => 'textarea', 'heading' => esc_attr__( 'Content', 'fusion-builder' ), 'description' => esc_attr__( 'Enter some text to highlight.', 'fusion-builder' ), 'param_name' => 'element_content', 'value' => '', ), array( 'type' => 'textfield', 'heading' => esc_attr__( 'CSS Class', 'fusion-builder' ), 'param_name' => 'class', 'value' => '', 'description' => esc_attr__( 'Add a class to the wrapping HTML element.', 'fusion-builder' ), ), array( 'type' => 'textfield', 'heading' => esc_attr__( 'CSS ID', 'fusion-builder' ), 'param_name' => 'id', 'value' => '', 'description' => esc_attr__( 'Add an ID to the wrapping HTML element.', 'fusion-builder' ), ), ), ) ); } add_action( 'fusion_builder_before_init', 'fusion_element_highlight' );