Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. CommentsRegistry.php

function CommentsRegistry::onNodeCompleted

Listener called every time a node is completed by the parser

Parameters

Node\Node $node Completed node:

Return value

void

File

vendor/mck89/peast/lib/Peast/Syntax/CommentsRegistry.php, line 161

Class

CommentsRegistry
Comments registry class. Internal class used to manage comments

Namespace

Peast\Syntax

Code

public function onNodeCompleted(Node\Node $node) {
    
    //Every time a node is completed, register its start and end indices
    
    //in the relative properties
    $loc = $node->location;
    foreach (array(
        "Start",
        "End",
    ) as $pos) {
        $val = $loc->{"get{$pos}"}()
            ->getIndex();
        $map =& $this->{"nodes{$pos}Map"};
        if (!isset($map[$val])) {
            $map[$val] = array();
        }
        $map[$val][] = $node;
    }
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal