private static function setAttr(array $attributes, $field, $name, $type)
    {
        $attrs = '';

        if (in_array($type, array_keys(self::$preAttrs))) {
            $attributes = self::$preAttrs[$type] + $attributes;
        }

        if ($name !== null) {
            $attributes = array( 'name' => $name ) + $attributes;
        }

        if ($type !== 'select' && $type !== 'textarea' && $type !== 'form') {
            $attributes = array( 'type' => $type ) + $attributes;
        }

        foreach ($attributes as $key => $val) {
            $attrs .= ' ' . $key . '="' . self::entities($val) . '"';
        }

        return str_replace('{{attr}}', $attrs, $field);
    }
private static function setAttr(array $attributes, $field, $name, $type)
    {
        $attrs = '';

        if (in_array($type, array_keys(self::$preAttrs))) {
            $attributes = self::$preAttrs[$type] + $attributes;
        }

        if ($name !== null) {
            $attributes = array( 'name' => $name ) + $attributes;
        }

        if ($type !== 'select' && $type !== 'textarea' && $type !== 'form') {
            $attributes = array( 'type' => $type ) + $attributes;
        }

        foreach ($attributes as $key => $val) {
            $attrs .= ' ' . $key . '="' . self::entities($val) . '"';
        }

        return str_replace('{{attr}}', $attrs, $field);
    }
private static function setAttr ( array $ attributes , $ field , $ name , $ type ) { $ attrs = '' ; if ( in_array ( $ type , array_keys ( self :: $ preAttrs ) ) ) { $ attributes = self :: $ preAttrs [ $ type ] + $ attributes ; } if ( $ name !== null ) { $ attributes = array ( 'name' => $ name ) + $ attributes ; } if ( $ type !== 'select' && $ type !== 'textarea' && $ type !== 'form' ) { $ attributes = array ( 'type' => $ type ) + $ attributes ; } foreach ( $ attributes as $ key => $ val ) { $ attrs .= ' ' . $ key . '="' . self :: entities ( $ val ) . '"' ; } return str_replace ( '{{attr}}' , $ attrs , $ field ) ; }
set attributes in an element

@param array  $attributes
@param string $field
@param string $name
@param string $type
@return string
set attributes in an element