]> _ Git - fluidbook-toolbox.git/commitdiff
wip #7083 @4
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 17 Sep 2024 10:39:28 +0000 (12:39 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 17 Sep 2024 10:39:28 +0000 (12:39 +0200)
app/Fields/Webflow/WebflowPage.php
app/Jobs/WebflowPublish.php
app/Models/ToolWebflow.php
app/Services/Webflow.php
composer.lock
resources/views/fields/webflow/images.blade.php
resources/views/fields/webflow/texts.blade.php

index 2f5bfd49ac0a852f878e411eaa1f291680474d79..6a2cabbfce5b0632582e16a8297ea2d785cfe304 100644 (file)
@@ -24,6 +24,8 @@ class WebflowPage extends SelectFromArray
             // otherwise return false
             false;
 
+
+
         if (!isset(static::$_opts[$id])) {
             static::$_opts[$id] = [];
             $wf = ToolWebflow::find($id);
index 58e49a1b4df0bd4edd93e52c9d10210d22fc8305..565fc3f13d86fbce26b06a4ca6eda4a86a3e0a90 100644 (file)
@@ -45,7 +45,7 @@ class WebflowPublish extends Base
         } else if ($this->mode === 'mirror') {
             $wf->mirror(false);
             $notify = false;
-        } else if ($this->mode === 'webflow' && $wf->webflow_refresh_on_publish) {
+        } else if ($this->mode === 'force_webflow' || ($this->mode === 'webflow' && $wf->webflow_refresh_on_publish)) {
             $wf->refreshFormDataFromAPI();
             $wf->mirror(false, true);
             $text = __('Le site vient d\'être républié suite à une mise à jour de webflow');
index 551150397f7c1cbafb20437dd7430c1fe6594b6d..abf6ec9b2179a4b233fabd5f37d66ede50df6010 100644 (file)
@@ -130,13 +130,15 @@ class ToolWebflow extends ToolboxTranslatableModel
         }
 
         $sitemap = simplexml_load_string($this->former_sitemap);
-        $sitemap->registerXPathNamespace('s', "http://www.sitemaps.org/schemas/sitemap/0.9");
-        foreach ($sitemap->xpath('//s:loc') as $url) {
-            $u = parse_url($url);
-            $p = trim($u['path'], '/');
-            if (!in_array($p, $froms)) {
-                $change = true;
-                $r[] = ['from' => $p, 'to' => ''];
+        if ($sitemap) {
+            $sitemap->registerXPathNamespace('s', "http://www.sitemaps.org/schemas/sitemap/0.9");
+            foreach ($sitemap->xpath('//s:loc') as $url) {
+                $u = parse_url($url);
+                $p = trim($u['path'], '/');
+                if (!in_array($p, $froms)) {
+                    $change = true;
+                    $r[] = ['from' => $p, 'to' => ''];
+                }
             }
         }
         if ($change) {
@@ -147,9 +149,8 @@ class ToolWebflow extends ToolboxTranslatableModel
 
     public function onSaved(): bool
     {
-
         if ($this->publish_on_save) {
-            $this->onPublish('auto');
+            $this->onPublish(!file_exists($this->getMirrorPath()) . 'index.html' ? 'force_webflow' : 'auto');
         }
         return parent::onSaved();
     }
@@ -171,47 +172,52 @@ class ToolWebflow extends ToolboxTranslatableModel
         $imagesChanged = false;
 
 
-        foreach ($seo[$mainLocale] as $page) {
+        if (isset($seo[$mainLocale])) {
+            foreach ($seo[$mainLocale] as $page) {
 
-            if ($page['og_title_copied']) {
-                $page['og_title'] = $page['seo_title'];
-            }
-            if ($page['og_description_copied']) {
-                $page['og_description'] = $page['seo_description'];
-            }
+                if ($page['og_title_copied']) {
+                    $page['og_title'] = $page['seo_title'];
+                }
+                if ($page['og_description_copied']) {
+                    $page['og_description'] = $page['seo_description'];
+                }
 
-            if (isset($api['seo'][$page['id']]) && $api['seo'][$page['id']]['type'] !== 'page_html' && !$this->_compareArrays($api['seo'][$page['id']], $page)) {
-                $api['seo'][$page['id']] = $page;
-                $hasChanged = true;
-                Webflow::savePageMeta($page);
+                if (isset($api['seo'][$page['id']]) && $api['seo'][$page['id']]['type'] !== 'page_html' && !$this->_compareArrays($api['seo'][$page['id']], $page)) {
+                    $api['seo'][$page['id']] = $page;
+                    $hasChanged = true;
+                    Webflow::savePageMeta($page);
+                }
             }
         }
 
-        foreach ($images[$mainLocale] as $id => $alt) {
-            $apiAlt = $api['images'][$id]['alt'];
-            if (str_starts_with($apiAlt, '__wf_')) {
-                $apiAlt = '';
-            }
-            if (null === $alt) {
-                $alt = '';
-            }
-            if ($apiAlt != $alt) {
-                start_measure('saveImageAlt ' . $apiAlt . '!=' . $alt);
-                $api['images'][$id]['alt'] = $alt;
-                Webflow::saveImageAlt($id, $alt);
-                $hasChanged = true;
-                stop_measure('saveImageAlt ' . $apiAlt . '!=' . $alt);
-            }
+        if (isset($images[$mainLocale])) {
 
-            if ($alt) {
-                foreach ($locales as $locale) {
-                    if ($locale === $mainLocale) {
-                        continue;
-                    }
-                    if (!$images[$locale][$id]) {
-                        $images[$locale][$id] = $translateAPI->translate($alt, $locale, $mainLocale);
-                        $imagesChanged = true;
-                        $hasChanged = true;
+            foreach ($images[$mainLocale] as $id => $alt) {
+                $apiAlt = $api['images'][$id]['alt'];
+                if (str_starts_with($apiAlt, '__wf_')) {
+                    $apiAlt = '';
+                }
+                if (null === $alt) {
+                    $alt = '';
+                }
+                if ($apiAlt != $alt) {
+                    start_measure('saveImageAlt ' . $apiAlt . '!=' . $alt);
+                    $api['images'][$id]['alt'] = $alt;
+                    Webflow::saveImageAlt($id, $alt);
+                    $hasChanged = true;
+                    stop_measure('saveImageAlt ' . $apiAlt . '!=' . $alt);
+                }
+
+                if ($alt) {
+                    foreach ($locales as $locale) {
+                        if ($locale === $mainLocale) {
+                            continue;
+                        }
+                        if (!$images[$locale][$id]) {
+                            $images[$locale][$id] = $translateAPI->translate($alt, $locale, $mainLocale);
+                            $imagesChanged = true;
+                            $hasChanged = true;
+                        }
                     }
                 }
             }
@@ -225,6 +231,7 @@ class ToolWebflow extends ToolboxTranslatableModel
             $this->saveQuietly();
         }
 
+
     }
 
     protected function _compareArrays($a, $b, $params = null)
@@ -401,6 +408,9 @@ class ToolWebflow extends ToolboxTranslatableModel
 
     public function listPages()
     {
+        if (!$this->webflow) {
+            return;
+        }
         $seo = $this->getEditableData()['seo'];
         $res = [];
         foreach ($seo as $s) {
@@ -501,6 +511,8 @@ class ToolWebflow extends ToolboxTranslatableModel
     protected function compileHTMLFile($f, $relative, $dest, $isMainLocale, $locale, $texts, $images, $seo, $env = 'dev')
     {
 
+
+
         $urlmaps = $this->getURLMaps();
         $urlmap = $urlmaps[$locale];
         $origRelative = $relative;
@@ -525,38 +537,47 @@ class ToolWebflow extends ToolboxTranslatableModel
             }
         }
 
+
+
         // Replace URL
         foreach ($urlmap as $k => $v) {
             $html = str_replace(ltrim($k, '/'), ltrim($v, '/'), $html);
         }
 
+        $localeURL = '';
 
-        $localeURL = "<script>";
-        foreach ($this->getLocales() as $l) {
-            $code = $l['locale'];
-            if ($code === $locale) {
-                continue;
+        $locales = $this->getLocales();
+        if (count($locales) > 1) {
+            $localeURL .= "<script>";
+            foreach ($locales as $l) {
+                $code = $l['locale'];
+                if ($code === $locale) {
+                    continue;
+                }
+                $u = $urlmaps[$code][$origRelative] ?? $origRelative;
+                $d = $l[$env === 'dev' ? 'url' : 'prod'];
+                $localeURL .= 'var SWITCH_URL_' . $code . '="https://' . $d . $u . '";' . "\n";
             }
-            $u = $urlmaps[$code][$origRelative] ?? $origRelative;
-            $d = $l[$env === 'dev' ? 'url' : 'prod'];
-            $localeURL .= 'var SWITCH_URL_' . $code . '="https://' . $d . $u . '";' . "\n";
+            $localeURL .= "</script>";
         }
-        $localeURL .= "</script>";
 
-        $html = str_replace('</head>', '<link href="/css/custom.css" rel="stylesheet">' . "\n" . '</head>', $html);
+        $html = str_replace('</head>', '<link href="/css/custom.css" rel="stylesheet">' ."\n". '</head>', $html);
         $html = str_replace('</body>', $localeURL . '<script src="/js/custom.js"></script>' . "\n" . '</body>', $html);
 
-        $html = preg_replace('/\s+lang=\"[a-zA-Z\-_]{2,6}\"/', ' lang="' . $locale . '"', $html);
+
+
+        $html = preg_replace('/\s+lang="[a-zA-Z\-_]{2,6}"/', ' lang="' . $locale . '"', $html);
+
 
         // Texts
         foreach ($texts as $text => $translation) {
             $html = str_replace('>' . $text . '<', '>' . $translation . '<', $html);
             $html = str_replace('>' . $text . ' <', '>' . $translation . ' <', $html);
         }
-
         // Images
 
 
+
         // SEO
         if (!$isMainLocale || $htmlPage) {
             foreach ($seo as $s) {
@@ -571,7 +592,7 @@ class ToolWebflow extends ToolboxTranslatableModel
                 $og_title = e($currentPage['og_title_copied'] ? $currentPage['seo_title'] : $currentPage['og_title']);
                 $og_desc = e($currentPage['og_description_copied'] ? $currentPage['seo_description'] : $currentPage['og_description']);
 
-                $html = preg_replace('/\s*<meta(.*)(name="description"|property="(og|twitter):\w+")(.*)\/>\s*/', '', $html);
+                $html = preg_replace('/\s*<meta([^<]*)(name="description"|property="(og|twitter):\w+")(.*)\/>\s*/U', '', $html);
                 $meta = '
     <meta content="' . e($currentPage['seo_description']) . '" name="description" />
     <meta content="' . $og_title . '" property="og:title" />
@@ -659,6 +680,10 @@ class ToolWebflow extends ToolboxTranslatableModel
     public function onRetrieved(): bool
     {
 
+        if (!$this->webflow) {
+            return parent::onRetrieved();
+        }
+
         Webflow::setToken($this->webflow_api_token);
         $lock = $this->getLock();
         try {
index 439e3793c3b62f51ea8d7cd3e27e54caf28991e7..2800b8dfef3e9629e9d32ff777bd5efc6a634864 100644 (file)
@@ -224,7 +224,7 @@ class Webflow
 
     public static function listCMSCollections($shortname)
     {
-        return self::request('sites/' . self::getSiteId($shortname) . '/collections')['collections'];
+        return self::request('sites/' . self::getSiteId($shortname) . '/collections')['collections'] ?? [];
     }
 
     public static function getPageContents($pageID)
@@ -315,7 +315,7 @@ class Webflow
                         $html = str_replace('<br>', "\n", $html);
                         $texts = Html::getTextNodes($html);
                         self::addTexts($texts, $res['texts']);
-                      //  dump($url, $texts);
+                        //  dump($url, $texts);
                     } else if ($node['type'] === 'image') {
 
                         if (!isset($node['image']['assetId'])) {
@@ -332,7 +332,7 @@ class Webflow
                 if (is_file($mirrorPath . $url)) {
                     $texts = Html::getTextNodes(file_get_contents($mirrorPath . $url));
                     self::addTexts($texts, $res['texts']);
-                   // dump('--' . $url, $texts);
+                    // dump('--' . $url, $texts);
                 }
             }
 
index f2db65703b744a26cf07abd4cf447e8ebadb6d22..6840020a26a08efe4c5141d9c318e60b09bc6180 100644 (file)
         },
         {
             "name": "cocur/slugify",
-            "version": "v4.5.1",
+            "version": "v4.6.0",
             "source": {
                 "type": "git",
                 "url": "https://github.com/cocur/slugify.git",
-                "reference": "7c6e088228b9f082050876ae8b0cd287b117b840"
+                "reference": "1d674022e9cbefa80b4f51aa3e2375b6e3c14fdb"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/cocur/slugify/zipball/7c6e088228b9f082050876ae8b0cd287b117b840",
-                "reference": "7c6e088228b9f082050876ae8b0cd287b117b840",
+                "url": "https://api.github.com/repos/cocur/slugify/zipball/1d674022e9cbefa80b4f51aa3e2375b6e3c14fdb",
+                "reference": "1d674022e9cbefa80b4f51aa3e2375b6e3c14fdb",
                 "shasum": ""
             },
             "require": {
                 "ext-mbstring": "*",
-                "php": "~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0"
+                "php": "~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0"
             },
             "conflict": {
                 "symfony/config": "<3.4 || >=4,<4.3",
             ],
             "support": {
                 "issues": "https://github.com/cocur/slugify/issues",
-                "source": "https://github.com/cocur/slugify/tree/v4.5.1"
+                "source": "https://github.com/cocur/slugify/tree/v4.6.0"
             },
-            "time": "2023-09-17T07:26:20+00:00"
+            "time": "2024-09-10T14:09:25+00:00"
         },
         {
             "name": "composer/package-versions-deprecated",
             "source": {
                 "type": "git",
                 "url": "git://git.cubedesigners.com/cubedesigners_userdatabase.git",
-                "reference": "49520520b567d68e6ccb298419aae252470572b1"
+                "reference": "3bb261ff5bf08ca0a684b6f21f9b48078307d5ab"
             },
             "dist": {
                 "type": "tar",
-                "url": "https://composer.cubedesigners.com/dist/cubedesigners/userdatabase/cubedesigners-userdatabase-dev-master-411776.tar",
-                "reference": "49520520b567d68e6ccb298419aae252470572b1",
-                "shasum": "b31edb7ab289a57a3d13c13415eeef4897401fc7"
+                "url": "https://composer.cubedesigners.com/dist/cubedesigners/userdatabase/cubedesigners-userdatabase-dev-master-83f3c6.tar",
+                "reference": "3bb261ff5bf08ca0a684b6f21f9b48078307d5ab",
+                "shasum": "902f9ac393e0ce0f5b1954b17fbec41214e98410"
             },
             "require": {
                 "cubist/cms-back": "dev-master",
                 }
             ],
             "description": "Cubedesigners common users database",
-            "time": "2024-07-30T08:50:50+00:00"
+            "time": "2024-09-09T13:11:27+00:00"
         },
         {
             "name": "cubist/azuretranslate",
             "source": {
                 "type": "git",
                 "url": "git://git.cubedesigners.com/cubist_cms-back.git",
-                "reference": "ca8a93553bd00620fad2f2f329735448544e584a"
+                "reference": "a5c754cd1afe85474abf5339476c0b0aa40a456c"
             },
             "dist": {
                 "type": "tar",
-                "url": "https://composer.cubedesigners.com/dist/cubist/cms-back/cubist-cms-back-dev-master-1db34e.tar",
-                "reference": "ca8a93553bd00620fad2f2f329735448544e584a",
-                "shasum": "93f072e4e523da940bef534d51f989916107d59e"
+                "url": "https://composer.cubedesigners.com/dist/cubist/cms-back/cubist-cms-back-dev-master-95e503.tar",
+                "reference": "a5c754cd1afe85474abf5339476c0b0aa40a456c",
+                "shasum": "a4dcadd416662e7d393e2a7a49b1ce9b98ad7b0c"
             },
             "require": {
                 "backpack/backupmanager": "^v3.0.9",
                 }
             ],
             "description": "Cubist Backpack extension",
-            "time": "2024-06-03T14:53:25+00:00"
+            "time": "2024-09-16T13:50:18+00:00"
         },
         {
             "name": "cubist/cms-front",
             "source": {
                 "type": "git",
                 "url": "git://git.cubedesigners.com/cubist_net.git",
-                "reference": "8d72260fe076601aa0e931af00b5817c4a90841e"
+                "reference": "9e806dd33e61656080742ece1f1fec4a27ec83f1"
             },
             "dist": {
                 "type": "tar",
-                "url": "https://composer.cubedesigners.com/dist/cubist/net/cubist-net-dev-master-c5f47b.tar",
-                "reference": "8d72260fe076601aa0e931af00b5817c4a90841e",
-                "shasum": "7407f73f68a5dd929fb3cf15a7f223d405a59545"
+                "url": "https://composer.cubedesigners.com/dist/cubist/net/cubist-net-dev-master-8de656.tar",
+                "reference": "9e806dd33e61656080742ece1f1fec4a27ec83f1",
+                "shasum": "cb573ca10c1c2afe265612fab45e88a91c6f66fb"
             },
             "require": {
                 "cubist/util": "dev-master",
                 }
             ],
             "description": "net cubist composer package",
-            "time": "2024-07-30T13:32:45+00:00"
+            "time": "2024-09-17T09:04:42+00:00"
         },
         {
             "name": "cubist/pdf",
             "source": {
                 "type": "git",
                 "url": "git://git.cubedesigners.com/cubist_util.git",
-                "reference": "5c932b5d0d2b648e09b029ec41172ebe3074fc52"
+                "reference": "59d40b831be36a4de00e2551e4da9b7ebc915826"
             },
             "dist": {
                 "type": "tar",
-                "url": "https://composer.cubedesigners.com/dist/cubist/util/cubist-util-dev-master-a98892.tar",
-                "reference": "5c932b5d0d2b648e09b029ec41172ebe3074fc52",
-                "shasum": "d348bd1b4c65d69de1941f5c0442dcce7f259487"
+                "url": "https://composer.cubedesigners.com/dist/cubist/util/cubist-util-dev-master-3feebc.tar",
+                "reference": "59d40b831be36a4de00e2551e4da9b7ebc915826",
+                "shasum": "e41f5451e68c3c8285c0e5a4cdd748ad88d9d548"
             },
             "require": {
                 "cubist/net": "dev-master",
                 }
             ],
             "description": "Utilities class",
-            "time": "2024-08-21T15:48:28+00:00"
+            "time": "2024-09-12T08:51:47+00:00"
         },
         {
             "name": "cviebrock/eloquent-sluggable",
             "source": {
                 "type": "git",
                 "url": "git://git.cubedesigners.com/fluidbook_tools.git",
-                "reference": "69cc53f0608c9001343f6903da7b6fefed8f4b92"
+                "reference": "73bb6cce228abe2b557339799fa21059d271f516"
             },
             "dist": {
                 "type": "tar",
-                "url": "https://composer.cubedesigners.com/dist/fluidbook/tools/fluidbook-tools-dev-master-04a0b4.tar",
-                "reference": "69cc53f0608c9001343f6903da7b6fefed8f4b92",
-                "shasum": "f12ad27474ba234203909158dcedef1a808a8202"
+                "url": "https://composer.cubedesigners.com/dist/fluidbook/tools/fluidbook-tools-dev-master-80f061.tar",
+                "reference": "73bb6cce228abe2b557339799fa21059d271f516",
+                "shasum": "b02f39bfaf2ab18389bf89ee4629eba4f853c096"
             },
             "require": {
                 "barryvdh/laravel-debugbar": "*",
                 }
             ],
             "description": "Fluidbook Tools",
-            "time": "2024-08-22T10:19:18+00:00"
+            "time": "2024-09-04T07:41:56+00:00"
         },
         {
             "name": "fpdf/fpdf",
         },
         {
             "name": "laravel/framework",
-            "version": "v10.48.20",
+            "version": "v10.48.22",
             "source": {
                 "type": "git",
                 "url": "https://github.com/laravel/framework.git",
-                "reference": "be2be342d4c74db6a8d2bd18469cd6d488ab9c98"
+                "reference": "c4ea52bb044faef4a103d7dd81746c01b2ec860e"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/laravel/framework/zipball/be2be342d4c74db6a8d2bd18469cd6d488ab9c98",
-                "reference": "be2be342d4c74db6a8d2bd18469cd6d488ab9c98",
+                "url": "https://api.github.com/repos/laravel/framework/zipball/c4ea52bb044faef4a103d7dd81746c01b2ec860e",
+                "reference": "c4ea52bb044faef4a103d7dd81746c01b2ec860e",
                 "shasum": ""
             },
             "require": {
                 "issues": "https://github.com/laravel/framework/issues",
                 "source": "https://github.com/laravel/framework"
             },
-            "time": "2024-08-09T07:55:45+00:00"
+            "time": "2024-09-12T15:00:09+00:00"
         },
         {
             "name": "laravel/prompts",
         },
         {
             "name": "maximebf/debugbar",
-            "version": "v1.22.5",
+            "version": "v1.22.6",
             "source": {
                 "type": "git",
                 "url": "https://github.com/maximebf/php-debugbar.git",
-                "reference": "1b5cabe0ce013134cf595bfa427bbf2f6abcd989"
+                "reference": "d7881b498f9e649610bf6ae91cdd6353859f75d2"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/maximebf/php-debugbar/zipball/1b5cabe0ce013134cf595bfa427bbf2f6abcd989",
-                "reference": "1b5cabe0ce013134cf595bfa427bbf2f6abcd989",
+                "url": "https://api.github.com/repos/maximebf/php-debugbar/zipball/d7881b498f9e649610bf6ae91cdd6353859f75d2",
+                "reference": "d7881b498f9e649610bf6ae91cdd6353859f75d2",
                 "shasum": ""
             },
             "require": {
             ],
             "support": {
                 "issues": "https://github.com/maximebf/php-debugbar/issues",
-                "source": "https://github.com/maximebf/php-debugbar/tree/v1.22.5"
+                "source": "https://github.com/maximebf/php-debugbar/tree/v1.22.6"
             },
-            "time": "2024-09-09T08:05:55+00:00"
+            "time": "2024-09-16T11:47:59+00:00"
         },
         {
             "name": "mews/purifier",
         },
         {
             "name": "psr/log",
-            "version": "3.0.1",
+            "version": "3.0.2",
             "source": {
                 "type": "git",
                 "url": "https://github.com/php-fig/log.git",
-                "reference": "79dff0b268932c640297f5208d6298f71855c03e"
+                "reference": "f16e1d5863e37f8d8c2a01719f5b34baa2b714d3"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/php-fig/log/zipball/79dff0b268932c640297f5208d6298f71855c03e",
-                "reference": "79dff0b268932c640297f5208d6298f71855c03e",
+                "url": "https://api.github.com/repos/php-fig/log/zipball/f16e1d5863e37f8d8c2a01719f5b34baa2b714d3",
+                "reference": "f16e1d5863e37f8d8c2a01719f5b34baa2b714d3",
                 "shasum": ""
             },
             "require": {
                 "psr-3"
             ],
             "support": {
-                "source": "https://github.com/php-fig/log/tree/3.0.1"
+                "source": "https://github.com/php-fig/log/tree/3.0.2"
             },
-            "time": "2024-08-21T13:31:24+00:00"
+            "time": "2024-09-11T13:17:53+00:00"
         },
         {
             "name": "psr/simple-cache",
         },
         {
             "name": "nikic/php-parser",
-            "version": "v5.1.0",
+            "version": "v5.2.0",
             "source": {
                 "type": "git",
                 "url": "https://github.com/nikic/PHP-Parser.git",
-                "reference": "683130c2ff8c2739f4822ff7ac5c873ec529abd1"
+                "reference": "23c79fbbfb725fb92af9bcf41065c8e9a0d49ddb"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/683130c2ff8c2739f4822ff7ac5c873ec529abd1",
-                "reference": "683130c2ff8c2739f4822ff7ac5c873ec529abd1",
+                "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/23c79fbbfb725fb92af9bcf41065c8e9a0d49ddb",
+                "reference": "23c79fbbfb725fb92af9bcf41065c8e9a0d49ddb",
                 "shasum": ""
             },
             "require": {
             ],
             "support": {
                 "issues": "https://github.com/nikic/PHP-Parser/issues",
-                "source": "https://github.com/nikic/PHP-Parser/tree/v5.1.0"
+                "source": "https://github.com/nikic/PHP-Parser/tree/v5.2.0"
             },
-            "time": "2024-07-01T20:03:41+00:00"
+            "time": "2024-09-15T16:40:33+00:00"
         },
         {
             "name": "nunomaduro/collision",
index 55558ffad65bfa68ea328e9e472e6acc451767be..15260708ebda7cfb9ffc098746d720485e96e713 100644 (file)
@@ -1,7 +1,7 @@
 @php
     $value=old(square_brackets_to_dots($field['name'])) ?? $field['value'] ?? $field['default'] ?? '[]';
     $translations=\Cubist\Util\Json::decode($value,\Cubist\Util\Json::TYPE_ARRAY)??[];
-    $images=\Cubist\Util\Json::decode($crud->entry->api,\Cubist\Util\Json::TYPE_ARRAY)['images'];
+    $images=(\Cubist\Util\Json::decode($crud->entry->api,\Cubist\Util\Json::TYPE_ARRAY)??['images'=>[]])['images'];
 @endphp
 
 @include('crud::fields.inc.wrapper_start')
index 5f096aabcf2ba76fa9791195f65f356f7b5ea31e..cd7693cd04904bc4e0fce4ec16e15fd9a9666794 100644 (file)
@@ -1,7 +1,8 @@
 @php
+
     $value=old(square_brackets_to_dots($field['name'])) ?? $field['value'] ?? $field['default'] ?? '[]';
     $translations=\Cubist\Util\Json::decode($value,\Cubist\Util\Json::TYPE_ARRAY)??[];
-    $texts=\Cubist\Util\Json::decode($crud->entry->api,\Cubist\Util\Json::TYPE_ARRAY)['texts'];
+    $texts=(\Cubist\Util\Json::decode($crud->entry->api,\Cubist\Util\Json::TYPE_ARRAY)??['texts'=>[]])['texts'];
 //    foreach ($translations as $key=>$trans) {
 //        $t=base64_decode($key);
 //        if(!isset($texts[$t])){