su_shortcode_lightbox_content

The shortcodes-ultimate su shortcode lightbox content function.

Published Date - February 15, 2021

Description

su_shortcode_lightbox_content( $atts, $content );

Parameters

  1. $atts

  2. $content


Usage

The following example is for adding a hook callback.

if ( !function_exists( 'su_shortcode_lightbox_content' ) ) {
    require_once ABSPATH . PLUGINDIR . 'shortcodes-ultimateshortcodes-ultimate/includes/shortcodes/lightbox-content.php';
}

// The input(s). 
$atts = null;
$content = null;

// NOTICE! Understand what this does before running.
$result = su_shortcode_lightbox_content( $atts, $content );
            

Defined

The function is defined in the following location(s).

shortcodes-ultimate/includes/shortcodes/lightbox-content.php

function su_shortcode_lightbox_content( $atts = null, $content = null ) {

	$atts = su_parse_shortcode_atts( 'lightbox_content', $atts );

	if ( ! $atts['id'] ) {

		return su_error_message(
			'Lightbox content',
			__( 'invalid ID. Use the value from the Content source field of the lightbox shortcode.', 'shortcodes-ultimate' )
		);

	}

	if ( is_numeric( $atts['margin'] ) ) {
		$atts['margin'] = "{$atts['margin']}px";
	}

	if ( is_numeric( $atts['padding'] ) ) {
		$atts['padding'] = "{$atts['padding']}px";
	}

	$style = array(
		'display:none',
		'width:' . sanitize_text_field( $atts['width'] ),
		'min-width:' . sanitize_text_field( $atts['min_width'] ),
		'max-width:' . sanitize_text_field( $atts['max_width'] ),
		'margin-top:' . sanitize_text_field( $atts['margin'] ),
		'margin-bottom:' . sanitize_text_field( $atts['margin'] ),
		'padding:' . sanitize_text_field( $atts['padding'] ),
		'background:' . sanitize_text_field( $atts['background'] ),
		'color:' . sanitize_text_field( $atts['color'] ),
		'box-shadow:' . sanitize_text_field( $atts['shadow'] ),
		'text-align:' . sanitize_key( $atts['text_align'] ),
	);

	$output = sprintf(
		'<div class="su-lightbox-content su-u-trim %1$s" id="%2$s"%3$s>%4$s</div>',
		su_get_css_class( $atts ),
		sanitize_html_class( $atts['id'] ),
		su_html_style( $style ),
		do_shortcode( $content )
	);

	if ( did_action( 'su/generator/preview/before' ) ) {

		$output = sprintf(
			'<div class="su-lightbox-content-preview">%s</div>',
			$output
		);

	}

	su_query_asset( 'css', 'su-shortcodes' );

	return $output;

}