luya\TagParser::inject PHP Method

inject() public static method

Inject a new tag with a given name and a configurable array config.
public static inject ( string $name, string | array $config )
$name string The name of the tag on what the tag should be found. Must be [a-z] chars.
$config string | array The configurable object context can be either a string with a class or a configurable array base on yii\base\Object concept.
    public static function inject($name, $config)
    {
        self::getInstance()->addTag($name, $config);
    }

Usage Example

Example #1
0
 public function testInjectTag()
 {
     TagParser::inject('foo', ['class' => LinkTag::class]);
     $tags = TagParser::getInstantiatedTagObjects();
     $this->arrayHasKey('foo', $tags);
     $this->assertInstanceOf('luya\\tag\\tags\\LinkTag', $tags['foo']);
 }
All Usage Examples Of luya\TagParser::inject