Flarum\Formatter\Formatter::getJs PHP Method

getJs() public method

Get the formatter JavaScript.
public getJs ( ) : string
return string
    public function getJs()
    {
        $configurator = $this->getConfigurator();
        $configurator->enableJavaScript();
        $configurator->javascript->exportMethods = ['preview'];
        return $configurator->finalize(['returnParser' => false, 'returnRenderer' => false])['js'];
    }

Usage Example

Beispiel #1
0
 /**
  * {@inheritdoc}
  */
 protected function getAssets()
 {
     $assets = parent::getAssets();
     $assets->addJs(function () {
         return $this->formatter->getJs();
     });
     return $assets;
 }
All Usage Examples Of Flarum\Formatter\Formatter::getJs