beans_close_markup

Register close markup by ID.

This function is similar to beans_open_markup(), but does not accept HTML attributes. The $id argument must be the identical to the opening markup.

beans_close_markup( string $id, string $tag )

Return: (string) The output.

Parameters

NameTypeRequiredDefaultDescription
$idstringtrue-Identical to the opening markup ID.
$tagstringtrue-The HTML tag.
$varmixedtrue-Additional variables passed to the functions hooked to $id.

Source

function beans_close_markup( $id, $tag ) {

	// Stop here if the tag is set to false, the before and after actions won't run in this case.
	if ( null === ( $tag = beans_apply_filters( $id . '_markup', $tag ) ) ) {
		return;
	}

	$args = func_get_args();

	// Remove function $tag argument.
	unset( $args[1] );

	// Set before action id.
	$args[0] = $id . '_append_markup';

	$output = call_user_func_array( '_beans_render_action', $args );

		// Don't output the tag if empty, the before and after actions still run.
		if ( $tag ) {
			$output .= '</' . $tag . '>';
		}

	// Set after action id.
	$args[0] = $id . '_after_markup';

	$output .= call_user_func_array( '_beans_render_action', $args );

	return $output;

}