Nestable\Services\NestableService::renderAttr PHP Méthode

renderAttr() protected méthode

Render the attritues of html elements.
protected renderAttr ( mixed $attributes = false, mixed $params = false ) : string
$attributes mixed
$params mixed
Résultat string
    protected function renderAttr($attributes = false, $params = false)
    {
        $attrStr = '';
        if (isset($attributes['callback'])) {
            $callbackParams = [$this];
            if ($params !== false) {
                array_push($callbackParams, $params);
            }
            call_user_func_array($attributes['callback'], $callbackParams);
        }
        if (is_array($attributes)) {
            foreach ($attributes as $attr => $value) {
                if (is_string($value)) {
                    $attrStr .= ' ' . $attr . '="' . $value . '"';
                }
            }
        }
        return $attrStr;
    }