src/Twig/Node/ComponentNode.php
/**
   * Compiles the component name.
   *
   * @param \Namics\Terrific\Twig\TerrificCompilerInterface $terrificCompiler
   *   The Terrific Twig compiler.
   *
   * @throws \Twig\Error\SyntaxError
   *   If the node name uses an unsupported format.
   */
Compiles the component name.
@param \Namics\Terrific\Twig\TerrificCompilerInterface $terrificCompiler
The Terrific Twig compiler.

@throws \Twig\Error\SyntaxError
If the node name uses an unsupported format.
Compiles the component name . @param \ Namics \ Terrific \ Twig \ TerrificCompilerInterface $terrificCompiler The Terrific Twig compiler . @throws \ Twig \ Error \ SyntaxError If the node name uses an unsupported format .
protected function compileComponentName(TerrificCompilerInterface $terrificCompiler): void {
    $node = $this->getNode('component');
    if ($node instanceof NameExpression) {
      $terrificCompiler->compileNameExpressionAsContextVariable($node);
    }
    elseif ($node instanceof ConstantExpression) {
      $terrificCompiler->getTwigCompiler()->subcompile($node);
    }
    elseif ($node instanceof GetAttrExpression) {
      $terrificCompiler->compileGetAttrExpressionAsContextVariable($node);
    }
    else {
      throw new SyntaxError('An unsupported data type was used for name to call a Twig Nitro component.');
    }
  }
protected function compileComponentName ( TerrificCompilerInterface $ terrificCompiler ) : void { $ node = $ this -> getNode ( 'component' ) ; if ( $ node instanceof NameExpression ) { $ terrificCompiler -> compileNameExpressionAsContextVariable ( $ node ) ; } elseif ( $ node instanceof ConstantExpression ) { $ terrificCompiler -> getTwigCompiler ( ) -> subcompile ( $ node ) ; } elseif ( $ node instanceof GetAttrExpression ) { $ terrificCompiler -> compileGetAttrExpressionAsContextVariable ( $ node ) ; } else { throw new SyntaxError ( 'An unsupported data type was used for name to call a Twig Nitro component.' ) ; } }
Compiles the component name.
Compiles the component name .
/* If a variable is used for component name,
    use it's value (is inside Terrifc context "$tContext") for template name.
    E.g. {% component myTwigComponentName { dataItem: 'my string' } %} */ /* If a static string (constant) is used for component name,
    compile it (prints it).
    E.g. {% component 'myComponent' { dataItem: 'my string' } %} */ /* If an object object/array used for component name,
    use it's value (is inside Terrifc context "$tContext") for template name.
    E.g. {% component myTwigObject.anObjectProperty.myTwigComponentName { dataItem: 'my string' } %} */