Appends content after the closing tag of a template tag.
Description
It positions the cursor in the closer tag of the balanced template tag, if it exists.
Parameters
$new_content
stringrequired- The string to append after the closing template tag.
Source
public function append_content_after_template_tag_closer( string $new_content ): bool {
if ( empty( $new_content ) || 'TEMPLATE' !== $this->get_tag() || ! $this->is_tag_closer() ) {
return false;
}
// Flushes any changes.
$this->get_updated_html();
$bookmark = 'append_content_after_template_tag_closer';
$this->set_bookmark( $bookmark );
$after_closing_tag = $this->bookmarks[ $bookmark ]->start + $this->bookmarks[ $bookmark ]->length;
$this->release_bookmark( $bookmark );
// Appends the new content.
$this->lexical_updates[] = new WP_HTML_Text_Replacement( $after_closing_tag, 0, $new_content );
return true;
}
User Contributed Notes
You must log in before being able to contribute a note or feedback.