WP_Interactivity_API_Directives_Processor::append_content_after_template_tag_closer
Appends content after the closing tag of a template tag.
It positions the cursor in the closer tag of the balanced template tag, if it exists.
Метод класса: WP_Interactivity_API_Directives_Processor{}
Внутренняя функция — эта функция рассчитана на использование самим ядром. Не рекомендуется использовать эту функцию в своем коде.
Хуков нет.
Возвращает
true|false. Whether the content was successfully appended.
Использование
$WP_Interactivity_API_Directives_Processor = new WP_Interactivity_API_Directives_Processor(); $WP_Interactivity_API_Directives_Processor->append_content_after_template_tag_closer( $new_content ): bool;
- $new_content(строка) (обязательный)
- The string to append after the closing template tag.
Список изменений
| С версии 6.5.0 | Введена. |
Код WP_Interactivity_API_Directives_Processor::append_content_after_template_tag_closer() WP Interactivity API Directives Processor::append content after template tag closer WP 6.9.4
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;
}