FOF30\Form\Field\User::getStatic PHP Метод

getStatic() публичный Метод

Get the rendering of this field type for static display, e.g. in a single item view (typically a "read" task).
С версии: 2.0
public getStatic ( ) : string
Результат string The field HTML
    public function getStatic()
    {
        if (isset($this->element['legacy'])) {
            return $this->getInput();
        }
        // Initialise
        $show_username = !$this->element['show_username'] == 'false';
        $show_email = $this->element['show_email'] == 'true';
        $show_name = $this->element['show_name'] == 'true';
        $show_id = $this->element['show_id'] == 'true';
        $class = $this->class ? ' class="' . $this->class . '"' : '';
        // Get the user record
        $user = $this->form->getContainer()->platform->getUser($this->value);
        // Render the HTML
        $html = '<div id="' . $this->id . '" ' . $class . '>';
        if ($show_username) {
            $html .= '<span class="fof-userfield-username">' . $user->username . '</span>';
        }
        if ($show_id) {
            $html .= '<span class="fof-userfield-id">' . $user->id . '</span>';
        }
        if ($show_name) {
            $html .= '<span class="fof-userfield-name">' . $user->name . '</span>';
        }
        if ($show_email) {
            $html .= '<span class="fof-userfield-email">' . $user->email . '</span>';
        }
        $html .= '</div>';
        return $html;
    }