Automattic\WooCommerce\EmailEditor\Integrations\Core\Renderer\Blocks
Image::apply_rounded_style
Apply rounded style to the image.
Метод класса: Image{}
Хуков нет.
Возвращает
null
. Ничего (null).
Использование
// private - только в коде основоного (родительского) класса $result = $this->apply_rounded_style( $block_content, $parsed_block ): string;
- $block_content(строка) (обязательный)
- Block content.
- $parsed_block(массив) (обязательный)
- Parsed block.
Код Image::apply_rounded_style() Image::apply rounded style WC 9.9.5
private function apply_rounded_style( string $block_content, array $parsed_block ): string { // Because the isn't an attribute for definition of rounded style, we have to check the class name. if ( isset( $parsed_block['attrs']['className'] ) && strpos( $parsed_block['attrs']['className'], 'is-style-rounded' ) !== false ) { // If the image should be in a circle, we need to set the border-radius to 9999px to make it the same as is in the editor // This style is applied to both wrapper and the image. $block_content = $this->remove_style_attribute_from_element( $block_content, array( 'tag_name' => 'td', 'class_name' => 'email-image-cell', ), 'border-radius' ); $block_content = $this->add_style_to_element( $block_content, array( 'tag_name' => 'td', 'class_name' => 'email-image-cell', ), 'border-radius: 9999px;' ); $block_content = $this->remove_style_attribute_from_element( $block_content, array( 'tag_name' => 'img' ), 'border-radius' ); $block_content = $this->add_style_to_element( $block_content, array( 'tag_name' => 'img' ), 'border-radius: 9999px;' ); } return $block_content; }