/ LJCPHPCodeDoc / LJCTextBuilderLib / LJCTextBuilder / GetCreate


Parameters
$name - The element name.
$text - The element content text.
$textState - The current text state values.
$htmlAttribs - The element attributes.
$addIndent - _ParamSummary_
$childIndent - _ParamSummary_
$isEmpty - Indicates if an empty element.
$close - Indicates if the element will be closed.

Returns

The HTML element.

Syntax

PHP
public function GetCreate(string $name, string $text
, LJCTextState $textState, LJCAttributes $attribs = null
, bool $addIndent = true, bool $childIndent = true, bool $isEmpty = false
, bool $close = true): string

Gets an element.

Remarks

GetCreate() is a "Get Text" method which creates the element or element opening tag and returns the text value. It is called from other element create methods.
The addIndent parameter defaults to true, which starts the text with the current indent string.
The isEmpty element defaults to false, which does not add the empty element slash.
If isEmpty is true, the empty element slash is added and the close parameter is ignored. The element will not include the closing tag.
The ChildIndentCount is incremented if the element is not empty and not closed.

Example

PHP
 // Root Method Begin
 $textState = new LJCTextState();
 
 $tb = new HTMLBuilder($textState);
 
 // Example Method:
 $result = $tb->GetCreate("p", "", $textState);
 
 // result:
 // <p></p>

Copyright © Lester J. Clark and Contributors.
Licensed under the MIT License.