getAttribute( 'class' ) ); $styles = css_string_to_array( $first->getAttribute( 'style' ) ); if ( $position ) { $classes[] = 'position-' . $position; } if ( $inset ) { $styles['top'] = $inset['top'] ?? null; $styles['right'] = $inset['right'] ?? null; $styles['bottom'] = $inset['bottom'] ?? null; $styles['left'] = $inset['left'] ?? null; } if ( $zIndex ) { $styles['z-index'] = $zIndex; } if ( $overflow ) { $styles['overflow-x'] = $overflow['x'] ?? null; $styles['overflow-y'] = $overflow['y'] ?? null; } $first->setAttribute( 'class', implode( ' ', $classes ) ); if ( $styles ) { $first->setAttribute( 'style', css_array_to_string( $styles ) ); } return $dom->saveHTML(); }