getAttribute( 'style' ) ); $styles['color'] = "var(--wp--preset--color--$textColor)"; $list_item->setAttribute( 'style', css_array_to_string( $styles ) ); $classes = explode( ' ', $list_item->getAttribute( 'class' ) ); $classes[] = 'has-text-color'; $list_item->setAttribute( 'class', implode( ' ', $classes ) ); $html = $dom->saveHTML(); } $service = $block['attrs']['service'] ?? null; if ( $service === 'slack' ) { $dom = dom( $html ); $li = get_dom_element( 'li', $dom ); $a = get_dom_element( 'a', $li ); $default_svg = get_dom_element( 'svg', $a ); if ( ! $default_svg ) { return $html; } $svg_dom = dom( file_get_contents( get_dir() . 'assets/svg/social/slack.svg' ) ); $svg = get_dom_element( 'svg', $svg_dom ); $svg->setAttribute( 'fill', 'currentColor' ); $svg->setAttribute( 'width', '24' ); $svg->setAttribute( 'height', '24' ); $svg->setAttribute( 'aria-hidden', 'true' ); $svg->setAttribute( 'focusable', 'false' ); $svg->setAttribute( 'role', 'img' ); $imported = $dom->importNode( $svg, true ); $a->appendChild( $imported ); $a->removeChild( $default_svg ); $html = $dom->saveHTML( $li ); } return $html; }