Flarum\Formatter\Formatter::parse PHP Method

parse() public method

Parse text.
public parse ( string $text, mixed $context = null ) : string
$text string
$context mixed
return string
    public function parse($text, $context = null)
    {
        $parser = $this->getParser($context);
        $this->events->fire(new ConfigureFormatterParser($parser, $context, $text));
        return $parser->parse($text);
    }

Usage Example

Beispiel #1
0
 /**
  * Parse the content before it is saved to the database.
  *
  * @param string $value
  */
 public function setContentAttribute($value)
 {
     $this->attributes['content'] = $value ? static::$formatter->parse($value, $this) : null;
 }