namespace App\Fields\Webflow;
+use App\Models\ToolWebflow;
use Cubist\Backpack\Magic\Fields\SelectFromArray;
class WebflowPage extends SelectFromArray
{
+ protected static $_opts = [];
+
+ public function getOptions()
+ {
+ $params = \Route::current()->parameters();
+
+ $id = // use the entity name to get the current entry
+ // this makes sure the ID is corrent even for nested resources
+ request()->input('tool-webflow') ??
+ // otherwise use the next to last parameter
+ array_values($params)[count($params) - 1] ??
+ // otherwise return false
+ false;
+
+ if (!isset(static::$_opts[$id])) {
+ static::$_opts[$id] = [];
+ static::$_opts[$id] = ToolWebflow::find($id)->listPages();
+ }
+
+ return static::$_opts[$id];
+ }
+
}
namespace App\Models;
use App\Fields\Webflow\WebflowImages;
+use App\Fields\Webflow\WebflowPage;
use App\Fields\Webflow\WebflowTexts;
use App\Http\Controllers\Admin\Operations\Tools\StaticSiteUploader;
use App\Http\Controllers\Admin\Operations\Tools\WebflowOperation;
use App\Services\Webflow;
use App\SubForms\Webflow\Redirection;
use App\SubForms\Webflow\SEOPage;
-use App\SubForms\Webflow\WebflowText;
use Cubist\Azure\Translate\Api;
use Cubist\Backpack\Magic\Fields\BunchOfFieldsMultiple;
use Cubist\Backpack\Magic\Fields\Code;
use Cubist\Util\Files\Files;
use Cubist\Util\Json;
use Illuminate\Contracts\Cache\Lock;
+use Illuminate\Contracts\Cache\LockTimeoutException;
use Illuminate\Support\Facades\Cache;
+use Illuminate\Support\Facades\Session;
// __('!! Outils')
class ToolWebflow extends ToolboxTranslatableModel
}
+ public function listPages()
+ {
+ $seo = Webflow::getEditableData($this->webflow)['seo'];
+ $res = [];
+ foreach ($seo as $s) {
+ $res[$s['id']] = $s['url'];
+ }
+ return $res;
+ }
+
public function compile()
{
$this->_parsePages();
if (is_string($locales)) {
$locales = json_decode($locales, true);
}
+
+ $data = $this->getEditableData();
+ $pages = [];
+ foreach ($data['seo'] as $s) {
+ $pages[$s['id']] = $s['url'];
+ }
+
Cache::put('webflow_' . $this->id . '_locales', $locales);
} catch (LockTimeoutException $e) {
public static function listSites()
{
- return self::request('sites')['sites'];
- }
+ $sites = self::request('sites');
+ if (isset($sites['sites'])) {
+ return $sites['sites'];
+ }
+ return [];
+ }
public static function getSiteId($shortname)
{
return $s['id'];
}
}
+ return false;
}
public static function getPageMeta($shortname, $pageID, $fromAPI = false, $force = false)
"source": {
"type": "git",
"url": "git://git.cubedesigners.com/cubist_azuretranslation.git",
- "reference": "96c398a7b3b02ffce5596ccec70f652c835a8f0f"
+ "reference": "b07c3277fa7b9be84f425292c30d99643fbe436a"
},
"dist": {
"type": "tar",
- "url": "https://composer.cubedesigners.com/dist/cubist/azuretranslate/cubist-azuretranslate-dev-master-08a45c.tar",
- "reference": "96c398a7b3b02ffce5596ccec70f652c835a8f0f",
- "shasum": "e518821d744806b22e9203506a439ee4567eae5e"
+ "url": "https://composer.cubedesigners.com/dist/cubist/azuretranslate/cubist-azuretranslate-dev-master-b7efd9.tar",
+ "reference": "b07c3277fa7b9be84f425292c30d99643fbe436a",
+ "shasum": "984ce027af2efef4875ae33d224d68f63635e64f"
},
"require": {
"ext-json": "*",
}
],
"description": "Azure Translate REST API",
- "time": "2024-06-05T10:59:57+00:00"
+ "time": "2024-06-05T14:04:45+00:00"
},
{
"name": "cubist/azuretts",