# ablocks/2.9.0/includes/import/image-parsers/wp/group-parser.php

aBlocks – Gutenberg Blocks, User Dashboard Builder, Popup Builder, Form Builder &amp; Animation Builder, version 2.9.0. 26 lines.

- Page: https://pluginprobe.com/plugins/ablocks/2.9.0/code/includes/import/image-parsers/wp/group-parser.php
- Raw: https://pluginprobe.com/plugins/ablocks/2.9.0/raw/includes/import/image-parsers/wp/group-parser.php
- Modified: 2025-03-06T07:54:56+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/ablocks/2.9.0/code/includes/import/image-parsers/wp/group-parser.php#L10-L20`.

```php
<?php

namespace ABlocks\import\ImageParsers\wp;

use ABlocks\import\ImageParsers\AbstractImageParser;

class GroupParser extends AbstractImageParser {

	public function parse() {
		$attrs     = $this->block['attrs'];
		$bg_exists = isset( $attrs['style'], $attrs['style']['background'], $attrs['style']['background']['backgroundImage'] );

		if ( $bg_exists ) {
			$imgUrl = $attrs['style']['background']['backgroundImage']['url'];

			if ( $this->check_external_url( $imgUrl ) ) {
				$attachment_id  = $this->upload_file( $imgUrl );
				$attachment_url = wp_get_attachment_url( $attachment_id );
				$this->block['attrs']['style']['background']['backgroundImage']['id']  = $attachment_id;
				$this->block['attrs']['style']['background']['backgroundImage']['url'] = $attachment_url;
			}
		}
	}

}

```
