Wrap markup.

This function calls beans_open_markup() before the opening markup and beans_close_markup() after the closing markup.

beans_wrap_markup( string $id, string $new_id, string $tag, string|array $attributes = array() )

Return: (bool) Will always return true.


$idstringtrue-The markup ID.
$new_idstringtrue-A unique string used as a reference. The $id argument may contain sub-hook(s).
$tagstringtrue-The HTML wrap tag.
$attributesstring|arrayfalsearray()Query string or array of attributes. The array key defines the attribute name and the array value define the attribute value. Setting the array value to '' will display the attribute value as empty (e.g. class=""). Setting it to 'false' will only display the attribute name (e.g. data-example). Setting it to 'null' will not display anything.
$varmixedtrue-Additional variables passed to the functions hooked to $id.


function beans_wrap_markup( $id, $new_id, $tag, $attributes = array() ) {

	$args = func_get_args();
	unset( $args[0] );

	_beans_add_anonymous_action( $id . '_before_markup', array( 'beans_open_markup', $args ), 9999 );

	unset( $args[3] );

	_beans_add_anonymous_action( $id . '_after_markup', array( 'beans_close_markup', $args ), 1 );

	return true;