PluginProbe
aBlocks – Gutenberg Blocks, User Dashboard Builder, Popup Builder, Form Builder & Animation Builder / 2.14.0
aBlocks – Gutenberg Blocks, User Dashboard Builder, Popup Builder, Form Builder & Animation Builder v2.14.0
2.14.0 2.13.0 2.13.1 2.12.0 2.11.1 2.11.0 2.10.0 2.9.0 2.7.4 2.7.5 2.7.6 2.7.7 2.8.0 2.8.1 2.9.1 trunk 1.0 1.0-beta1 1.0-beta2 1.0-beta3 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 All 81 releases
← All changes | includes/import/image-parsers/wp/group-parser.php +25 -0 2.7.5 → 2.14.0 View file →
@@ -1,0 +1,25 @@
1 +<?php
2 +
3 +namespace ABlocks\import\ImageParsers\wp;
4 +
5 +use ABlocks\import\ImageParsers\AbstractImageParser;
6 +
7 +class GroupParser extends AbstractImageParser {
8 +
9 + public function parse() {
10 + $attrs = $this->block['attrs'];
11 + $bg_exists = isset( $attrs['style'], $attrs['style']['background'], $attrs['style']['background']['backgroundImage'] );
12 +
13 + if ( $bg_exists ) {
14 + $imgUrl = $attrs['style']['background']['backgroundImage']['url'];
15 +
16 + if ( $this->check_external_url( $imgUrl ) ) {
17 + $attachment_id = $this->upload_file( $imgUrl );
18 + $attachment_url = wp_get_attachment_url( $attachment_id );
19 + $this->block['attrs']['style']['background']['backgroundImage']['id'] = $attachment_id;
20 + $this->block['attrs']['style']['background']['backgroundImage']['url'] = $attachment_url;
21 + }
22 + }
23 + }
24 +
25 +}