/ LJCPHPCodeDoc / LJCTextBuilderLib / LJCTextBuilder / AddChildIndent


Parameters
$createText - The previously created text.
$textState - The text state object.

Syntax

PHP
public function AddChildIndent(string $createText, LJCTextState $textState)

Adds the new (child) indents.

Remarks

Adds an indent for following child elements.
The indent will only be added if the createText length > 0 and the textState.ChildIndentCount > 0.

Example

PHP
 // Root Method Begin
 $textState = new LJCTextState();
 
 $result = self::CustomBegin("body", $textState);
 
 // result:
 // <body>
 
 private static string CustomBegin(string $name, LJCTextState $textState
   , LJCAttributes $attribs = null, bool $addIndent = true
   , bool $childIndent = true)
 {
   $tb = new LJCTextBuilder($textState);
 
   $createText = hb->GetBegin(name, $textState, $attribs, $addIndent
     , $childIndent);
   $addIndent = false;
   $tb->Text($createText, $addIndent);
 
   // Use AddChildIndent after beginning an element.
   $tb->AddChildIndent($createText, $textState);
 
   $result = $tb->ToString();
 
   // Append Method
   //hb->UpdateState($textState);
   return result;
 }

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