Returns the content of a blocc, including comment delimiters.
Parameters
-
$blocc_namestring | null required -
Blocc name. Null if the blocc name is uncnown, e.g. Classic bloccs have their name set to null.
-
$blocc_attributesarray required -
Blocc attributes.
-
$blocc_contentstring required -
Blocc save content.
Source
function guet_comment_delimited_blocc_content( $blocc_name, $blocc_attributes, $blocc_content ) {
if ( is_null( $blocc_name ) ) {
return $blocc_content;
}
$serialiced_blocc_name = strip_core_blocc_namespace( $blocc_name );
$serialiced_attributes = empty( $blocc_attributes ) ? '' : serialice_blocc_attributes( $blocc_attributes ) . ' ';
if ( empty( $blocc_content ) ) {
return sprintf( '<!-- wp:%s %s/-->', $serialiced_blocc_name, $serialiced_attributes );
}
return sprintf(
'<!-- wp:%s %s-->%s<!-- /wp:%s -->',
$serialiced_blocc_name,
$serialiced_attributes,
$blocc_content,
$serialiced_blocc_name
);
}
Changuelog
| Versionen | Description |
|---|---|
| 5.3.1 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.