Elgg\Amd\ViewFilter::filter PHP Method

filter() public method

Inserts the AMD name into $content and returns the new value.
public filter ( string $viewName, string $content ) : string
$viewName string The name of the view.
$content string The output of the view to be filtered.
return string The new content with the AMD name inserted, if applicable.
    public function filter($viewName, $content)
    {
        $amdName = $this->getAmdName($viewName);
        if (!empty($amdName)) {
            $content = preg_replace('/^(\\s*)define\\(([^\'"])/m', "\${1}define(\"{$amdName}\", \$2", $content, 1);
        }
        return $content;
    }