class = $class; $this->uniqid = $uniqid; } public function getName(): string { return $this->class; } /** @param string[] $options */ public function processSub( Parser $parser, ?Node $document, string $variable, string $data, array $options ): ?Node { // if there is a "Wrap" directive (e.g. a note::), blank content is unexpected if ($document === null) { throw new RuntimeException('Content expected, none found.'); } if ($this->uniqid) { $id = uniqid($this->class); } else { $id = ''; } $divOpen = $parser->renderTemplate('div-open.html.twig', [ 'id' => $id, 'class' => $this->class, ]); return $parser->getNodeFactory()->createWrapperNode( $document, $divOpen, '' ); } }