Pimcore\Model\Document\Tag::__toString PHP Method

__toString() public method

direct output to the frontend
public __toString ( ) : string
return string
    public function __toString()
    {
        $return = "";
        try {
            if ($this->editmode) {
                $return = $this->admin();
            } else {
                $return = $this->frontend();
            }
        } catch (\Exception $e) {
            if (\Pimcore::inDebugMode()) {
                // the __toString method isn't allowed to throw exceptions
                $return = '<b style="color:#f00">' . $e->getMessage() . '</b><br/>' . $e->getTraceAsString();
            }
            Logger::error("to string not possible - " . $e->getMessage());
        }
        if (is_string($return) || is_numeric($return)) {
            // we have to cast to string, because int/float is not auto-converted and throws an exception
            return (string) $return;
        }
        return '';
    }