Commit c40db963 by liumengfei

升级webp插件

卸载pagebuilder 插件
parent 2fc7e911

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.

......@@ -76,7 +76,6 @@
"magenest/module-google-shopping": "^1.1",
"magento/composer": "1.6.0",
"magento/magento-composer-installer": ">=0.1.11",
"magento/page-builder": "dev-developer",
"magento/zendframework1": "~1.14.2",
"mageside/module-subscribe-at-checkout": "1.1.7",
"mobiledetect/mobiledetectlib": "^2.8",
......@@ -401,14 +400,10 @@
},
"prefer-stable": true,
"repositories": {
"ext": {
"type": "path",
"url": "./ext/*/*/*/*/*/*"
},
"0": {
"type": "composer",
"url": "https://repo.magento.com/"
}
},
"minimum-stability": "dev"
}
}
......@@ -2,6 +2,24 @@
// autoload.php @generated by Composer
if (PHP_VERSION_ID < 50600) {
if (!headers_sent()) {
header('HTTP/1.1 500 Internal Server Error');
}
$err = 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL;
if (!ini_get('display_errors')) {
if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
fwrite(STDERR, $err);
} elseif (!headers_sent()) {
echo $err;
}
}
trigger_error(
$err,
E_USER_ERROR
);
}
require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInitb71ce7c407b65980cf51508f463c8dcf::getLoader();
......@@ -42,6 +42,9 @@ namespace Composer\Autoload;
*/
class ClassLoader
{
/** @var \Closure(string):void */
private static $includeFile;
/** @var ?string */
private $vendorDir;
......@@ -106,6 +109,7 @@ class ClassLoader
public function __construct($vendorDir = null)
{
$this->vendorDir = $vendorDir;
self::initializeIncludeClosure();
}
/**
......@@ -425,7 +429,8 @@ class ClassLoader
public function loadClass($class)
{
if ($file = $this->findFile($class)) {
includeFile($file);
$includeFile = self::$includeFile;
$includeFile($file);
return true;
}
......@@ -555,18 +560,26 @@ class ClassLoader
return false;
}
}
/**
* Scope isolated include.
*
* Prevents access to $this/self from included files.
*
* @param string $file
* @return void
* @private
*/
function includeFile($file)
{
include $file;
/**
* @return void
*/
private static function initializeIncludeClosure()
{
if (self::$includeFile !== null) {
return;
}
/**
* Scope isolated include.
*
* Prevents access to $this/self from included files.
*
* @param string $file
* @return void
*/
self::$includeFile = \Closure::bind(static function($file) {
include $file;
}, null, null);
}
}
......@@ -21,12 +21,14 @@ use Composer\Semver\VersionParser;
* See also https://getcomposer.org/doc/07-runtime.md#installed-versions
*
* To require its presence, you can require `composer-runtime-api ^2.0`
*
* @final
*/
class InstalledVersions
{
/**
* @var mixed[]|null
* @psalm-var array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}|array{}|null
* @psalm-var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}|array{}|null
*/
private static $installed;
......@@ -37,7 +39,7 @@ class InstalledVersions
/**
* @var array[]
* @psalm-var array<string, array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}>
* @psalm-var array<string, array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
*/
private static $installedByVendor = array();
......@@ -96,7 +98,7 @@ class InstalledVersions
{
foreach (self::getInstalled() as $installed) {
if (isset($installed['versions'][$packageName])) {
return $includeDevRequirements || empty($installed['versions'][$packageName]['dev_requirement']);
return $includeDevRequirements || !isset($installed['versions'][$packageName]['dev_requirement']) || $installed['versions'][$packageName]['dev_requirement'] === false;
}
}
......@@ -117,7 +119,7 @@ class InstalledVersions
*/
public static function satisfies(VersionParser $parser, $packageName, $constraint)
{
$constraint = $parser->parseConstraints($constraint);
$constraint = $parser->parseConstraints((string) $constraint);
$provided = $parser->parseConstraints(self::getVersionRanges($packageName));
return $provided->matches($constraint);
......@@ -241,7 +243,7 @@ class InstalledVersions
/**
* @return array
* @psalm-return array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}
* @psalm-return array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}
*/
public static function getRootPackage()
{
......@@ -255,7 +257,7 @@ class InstalledVersions
*
* @deprecated Use getAllRawData() instead which returns all datasets for all autoloaders present in the process. getRawData only returns the first dataset loaded, which may not be what you expect.
* @return array[]
* @psalm-return array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}
* @psalm-return array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}
*/
public static function getRawData()
{
......@@ -278,7 +280,7 @@ class InstalledVersions
* Returns the raw data of all installed.php which are currently loaded for custom implementations
*
* @return array[]
* @psalm-return list<array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}>
* @psalm-return list<array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
*/
public static function getAllRawData()
{
......@@ -301,7 +303,7 @@ class InstalledVersions
* @param array[] $data A vendor/composer/installed.php data set
* @return void
*
* @psalm-param array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>} $data
* @psalm-param array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $data
*/
public static function reload($data)
{
......@@ -311,7 +313,7 @@ class InstalledVersions
/**
* @return array[]
* @psalm-return list<array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}>
* @psalm-return list<array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
*/
private static function getInstalled()
{
......@@ -326,7 +328,9 @@ class InstalledVersions
if (isset(self::$installedByVendor[$vendorDir])) {
$installed[] = self::$installedByVendor[$vendorDir];
} elseif (is_file($vendorDir.'/composer/installed.php')) {
$installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php';
/** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
$required = require $vendorDir.'/composer/installed.php';
$installed[] = self::$installedByVendor[$vendorDir] = $required;
if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) {
self::$installed = $installed[count($installed) - 1];
}
......@@ -338,12 +342,17 @@ class InstalledVersions
// only require the installed.php file if this file is loaded from its dumped location,
// and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
if (substr(__DIR__, -8, 1) !== 'C') {
self::$installed = require __DIR__ . '/installed.php';
/** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
$required = require __DIR__ . '/installed.php';
self::$installed = $required;
} else {
self::$installed = array();
}
}
$installed[] = self::$installed;
if (self::$installed !== array()) {
$installed[] = self::$installed;
}
return $installed;
}
......
......@@ -2,7 +2,7 @@
// autoload_classmap.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$vendorDir = dirname(__DIR__);
$baseDir = dirname($vendorDir);
return array(
......
......@@ -2,7 +2,7 @@
// autoload_files.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$vendorDir = dirname(__DIR__);
$baseDir = dirname($vendorDir);
return array(
......@@ -27,8 +27,6 @@ return array(
'e3b2795a8a512b6083af088fb53afe6c' => $vendorDir . '/codeception/codeception/functions.php',
'3e76f7f02b41af8cea96018933f6b7e3' => $vendorDir . '/hoa/protocol/Wrapper.php',
'518a2675cc640353ef5a4a6cc36ccbdf' => $vendorDir . '/swissup/module-rtl/registration.php',
'a291bc41d6662dad619f145d3da50895' => $vendorDir . '/magento/module-page-builder/registration.php',
'f283a248afeee67ebafcc47ba7f75b4d' => $vendorDir . '/magento/module-page-builder-analytics/registration.php',
'56ae56c146e4ab9df63cb9f8b04c5321' => $vendorDir . '/swissup/module-breeze/registration.php',
'e39a8b23c42d4e1452234d762b03835a' => $vendorDir . '/ramsey/uuid/src/functions.php',
'51fcf4e06c07cc00c920b44bcd900e7a' => $vendorDir . '/thecodingmachine/safe/deprecated/apc.php',
......@@ -130,10 +128,6 @@ return array(
'ad155f8f1cf0d418fe49e248db8c661b' => $vendorDir . '/react/promise/src/functions_include.php',
'a8d3953fd9959404dd22d3dfcd0a79f0' => $vendorDir . '/google/apiclient/src/aliases.php',
'1962eb38a2207e9a5c3fe81dd045ccbd' => $vendorDir . '/magenest/core/registration.php',
'3341aec7bc6ef4825cef596bd4dbbc07' => $vendorDir . '/magento/module-aws-s3-page-builder/registration.php',
'f4196ce39b190211cffd1064290ac1b0' => $vendorDir . '/magento/module-catalog-page-builder-analytics/registration.php',
'd480b9e729304b855a88fbd77665435f' => $vendorDir . '/magento/module-cms-page-builder-analytics/registration.php',
'b83b8c2f06c17e50419019e996be8e60' => $vendorDir . '/magento/module-page-builder-admin-analytics/registration.php',
'103e25fab6e1520b3d5716d51befc8a8' => $vendorDir . '/swissup/module-breeze-integrations/registration.php',
'cbb1b03512ba520311d1592006f0c299' => $vendorDir . '/swissup/theme-frontend-breeze-blank/registration.php',
'940abd8fb01ee76a36b44f35dcf9783b' => $vendorDir . '/weew/helpers-array/src/array.php',
......
......@@ -2,7 +2,7 @@
// autoload_namespaces.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$vendorDir = dirname(__DIR__);
$baseDir = dirname($vendorDir);
return array(
......
......@@ -2,7 +2,7 @@
// autoload_psr4.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$vendorDir = dirname(__DIR__);
$baseDir = dirname($vendorDir);
return array(
......@@ -77,15 +77,9 @@ return array(
'Magento\\Sniffs\\' => array($baseDir . '/dev/tests/static/framework/Magento/Sniffs'),
'Magento\\Setup\\' => array($baseDir . '/setup/src/Magento/Setup'),
'Magento\\PhpStan\\' => array($baseDir . '/dev/tests/static/framework/Magento/PhpStan'),
'Magento\\PageBuilder\\' => array($vendorDir . '/magento/module-page-builder'),
'Magento\\PageBuilderAnalytics\\' => array($vendorDir . '/magento/module-page-builder-analytics'),
'Magento\\PageBuilderAdminAnalytics\\' => array($vendorDir . '/magento/module-page-builder-admin-analytics'),
'Magento\\FunctionalTestingFramework\\' => array($vendorDir . '/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework'),
'Magento\\Framework\\' => array($baseDir . '/lib/internal/Magento/Framework'),
'Magento\\Composer\\' => array($vendorDir . '/magento/composer/src'),
'Magento\\CmsPageBuilderAnalytics\\' => array($vendorDir . '/magento/module-cms-page-builder-analytics'),
'Magento\\CatalogPageBuilderAnalytics\\' => array($vendorDir . '/magento/module-catalog-page-builder-analytics'),
'Magento\\AwsS3PageBuilder\\' => array($vendorDir . '/magento/module-aws-s3-page-builder'),
'Magento\\' => array($baseDir . '/app/code/Magento'),
'Magento2\\' => array($vendorDir . '/magento/magento-coding-standard/Magento2'),
'Magenest\\GoogleShopping\\' => array($vendorDir . '/magenest/module-google-shopping'),
......@@ -150,8 +144,6 @@ return array(
'GuzzleHttp\\Psr7\\' => array($vendorDir . '/guzzlehttp/psr7/src'),
'GuzzleHttp\\Promise\\' => array($vendorDir . '/guzzlehttp/promises/src'),
'GuzzleHttp\\' => array($vendorDir . '/guzzlehttp/guzzle/src'),
'Gt\\Dom\\' => array($vendorDir . '/phpgt/dom/src'),
'Gt\\CssXPath\\' => array($vendorDir . '/phpgt/cssxpath/src'),
'GraphQL\\' => array($vendorDir . '/webonyx/graphql-php/src'),
'Google\\Service\\' => array($vendorDir . '/google/apiclient-services/src'),
'Google\\Auth\\' => array($vendorDir . '/google/auth/src'),
......
......@@ -25,60 +25,30 @@ class ComposerAutoloaderInitb71ce7c407b65980cf51508f463c8dcf
require __DIR__ . '/platform_check.php';
spl_autoload_register(array('ComposerAutoloaderInitb71ce7c407b65980cf51508f463c8dcf', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
spl_autoload_unregister(array('ComposerAutoloaderInitb71ce7c407b65980cf51508f463c8dcf', 'loadClassLoader'));
$includePaths = require __DIR__ . '/include_paths.php';
$includePaths[] = get_include_path();
set_include_path(implode(PATH_SEPARATOR, $includePaths));
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
if ($useStaticLoader) {
require __DIR__ . '/autoload_static.php';
require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInitb71ce7c407b65980cf51508f463c8dcf::getInitializer($loader));
call_user_func(\Composer\Autoload\ComposerStaticInitb71ce7c407b65980cf51508f463c8dcf::getInitializer($loader));
} else {
$map = require __DIR__ . '/autoload_namespaces.php';
foreach ($map as $namespace => $path) {
$loader->set($namespace, $path);
}
$loader->register(true);
$map = require __DIR__ . '/autoload_psr4.php';
foreach ($map as $namespace => $path) {
$loader->setPsr4($namespace, $path);
}
$filesToLoad = \Composer\Autoload\ComposerStaticInitb71ce7c407b65980cf51508f463c8dcf::$files;
$requireFile = \Closure::bind(static function ($fileIdentifier, $file) {
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
$classMap = require __DIR__ . '/autoload_classmap.php';
if ($classMap) {
$loader->addClassMap($classMap);
require $file;
}
}
$loader->register(true);
if ($useStaticLoader) {
$includeFiles = Composer\Autoload\ComposerStaticInitb71ce7c407b65980cf51508f463c8dcf::$files;
} else {
$includeFiles = require __DIR__ . '/autoload_files.php';
}
foreach ($includeFiles as $fileIdentifier => $file) {
composerRequireb71ce7c407b65980cf51508f463c8dcf($fileIdentifier, $file);
}, null, null);
foreach ($filesToLoad as $fileIdentifier => $file) {
$requireFile($fileIdentifier, $file);
}
return $loader;
}
}
/**
* @param string $fileIdentifier
* @param string $file
* @return void
*/
function composerRequireb71ce7c407b65980cf51508f463c8dcf($fileIdentifier, $file)
{
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
require $file;
}
}
......@@ -28,8 +28,6 @@ class ComposerStaticInitb71ce7c407b65980cf51508f463c8dcf
'e3b2795a8a512b6083af088fb53afe6c' => __DIR__ . '/..' . '/codeception/codeception/functions.php',
'3e76f7f02b41af8cea96018933f6b7e3' => __DIR__ . '/..' . '/hoa/protocol/Wrapper.php',
'518a2675cc640353ef5a4a6cc36ccbdf' => __DIR__ . '/..' . '/swissup/module-rtl/registration.php',
'a291bc41d6662dad619f145d3da50895' => __DIR__ . '/..' . '/magento/module-page-builder/registration.php',
'f283a248afeee67ebafcc47ba7f75b4d' => __DIR__ . '/..' . '/magento/module-page-builder-analytics/registration.php',
'56ae56c146e4ab9df63cb9f8b04c5321' => __DIR__ . '/..' . '/swissup/module-breeze/registration.php',
'e39a8b23c42d4e1452234d762b03835a' => __DIR__ . '/..' . '/ramsey/uuid/src/functions.php',
'51fcf4e06c07cc00c920b44bcd900e7a' => __DIR__ . '/..' . '/thecodingmachine/safe/deprecated/apc.php',
......@@ -131,10 +129,6 @@ class ComposerStaticInitb71ce7c407b65980cf51508f463c8dcf
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
'a8d3953fd9959404dd22d3dfcd0a79f0' => __DIR__ . '/..' . '/google/apiclient/src/aliases.php',
'1962eb38a2207e9a5c3fe81dd045ccbd' => __DIR__ . '/..' . '/magenest/core/registration.php',
'3341aec7bc6ef4825cef596bd4dbbc07' => __DIR__ . '/..' . '/magento/module-aws-s3-page-builder/registration.php',
'f4196ce39b190211cffd1064290ac1b0' => __DIR__ . '/..' . '/magento/module-catalog-page-builder-analytics/registration.php',
'd480b9e729304b855a88fbd77665435f' => __DIR__ . '/..' . '/magento/module-cms-page-builder-analytics/registration.php',
'b83b8c2f06c17e50419019e996be8e60' => __DIR__ . '/..' . '/magento/module-page-builder-admin-analytics/registration.php',
'103e25fab6e1520b3d5716d51befc8a8' => __DIR__ . '/..' . '/swissup/module-breeze-integrations/registration.php',
'cbb1b03512ba520311d1592006f0c299' => __DIR__ . '/..' . '/swissup/theme-frontend-breeze-blank/registration.php',
'940abd8fb01ee76a36b44f35dcf9783b' => __DIR__ . '/..' . '/weew/helpers-array/src/array.php',
......@@ -251,15 +245,9 @@ class ComposerStaticInitb71ce7c407b65980cf51508f463c8dcf
'Magento\\Sniffs\\' => 15,
'Magento\\Setup\\' => 14,
'Magento\\PhpStan\\' => 16,
'Magento\\PageBuilder\\' => 20,
'Magento\\PageBuilderAnalytics\\' => 29,
'Magento\\PageBuilderAdminAnalytics\\' => 34,
'Magento\\FunctionalTestingFramework\\' => 35,
'Magento\\Framework\\' => 18,
'Magento\\Composer\\' => 17,
'Magento\\CmsPageBuilderAnalytics\\' => 32,
'Magento\\CatalogPageBuilderAnalytics\\' => 36,
'Magento\\AwsS3PageBuilder\\' => 25,
'Magento\\' => 8,
'Magento2\\' => 9,
'Magenest\\GoogleShopping\\' => 24,
......@@ -336,8 +324,6 @@ class ComposerStaticInitb71ce7c407b65980cf51508f463c8dcf
'GuzzleHttp\\Psr7\\' => 16,
'GuzzleHttp\\Promise\\' => 19,
'GuzzleHttp\\' => 11,
'Gt\\Dom\\' => 7,
'Gt\\CssXPath\\' => 12,
'GraphQL\\' => 8,
'Google\\Service\\' => 15,
'Google\\Auth\\' => 12,
......@@ -680,18 +666,6 @@ class ComposerStaticInitb71ce7c407b65980cf51508f463c8dcf
array (
0 => __DIR__ . '/../..' . '/dev/tests/static/framework/Magento/PhpStan',
),
'Magento\\PageBuilder\\' =>
array (
0 => __DIR__ . '/..' . '/magento/module-page-builder',
),
'Magento\\PageBuilderAnalytics\\' =>
array (
0 => __DIR__ . '/..' . '/magento/module-page-builder-analytics',
),
'Magento\\PageBuilderAdminAnalytics\\' =>
array (
0 => __DIR__ . '/..' . '/magento/module-page-builder-admin-analytics',
),
'Magento\\FunctionalTestingFramework\\' =>
array (
0 => __DIR__ . '/..' . '/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework',
......@@ -704,18 +678,6 @@ class ComposerStaticInitb71ce7c407b65980cf51508f463c8dcf
array (
0 => __DIR__ . '/..' . '/magento/composer/src',
),
'Magento\\CmsPageBuilderAnalytics\\' =>
array (
0 => __DIR__ . '/..' . '/magento/module-cms-page-builder-analytics',
),
'Magento\\CatalogPageBuilderAnalytics\\' =>
array (
0 => __DIR__ . '/..' . '/magento/module-catalog-page-builder-analytics',
),
'Magento\\AwsS3PageBuilder\\' =>
array (
0 => __DIR__ . '/..' . '/magento/module-aws-s3-page-builder',
),
'Magento\\' =>
array (
0 => __DIR__ . '/../..' . '/app/code/Magento',
......@@ -983,14 +945,6 @@ class ComposerStaticInitb71ce7c407b65980cf51508f463c8dcf
array (
0 => __DIR__ . '/..' . '/guzzlehttp/guzzle/src',
),
'Gt\\Dom\\' =>
array (
0 => __DIR__ . '/..' . '/phpgt/dom/src',
),
'Gt\\CssXPath\\' =>
array (
0 => __DIR__ . '/..' . '/phpgt/cssxpath/src',
),
'GraphQL\\' =>
array (
0 => __DIR__ . '/..' . '/webonyx/graphql-php/src',
......
......@@ -2,7 +2,7 @@
// include_paths.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$vendorDir = dirname(__DIR__);
$baseDir = dirname($vendorDir);
return array(
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -141,7 +141,7 @@ class Result extends \Magento\Framework\View\Element\Template
underscore (_), minus (-), space ( ) and alphanumeric characters.');
return false;
} else {
$process = new SymfonyProcess(
$process = SymfonyProcess::fromShellCommandline(
escapeshellarg($cmd) . ' '
. $imagePath . ' '
. $customCommand . ' '
......@@ -149,7 +149,7 @@ class Result extends \Magento\Framework\View\Element\Template
);
}
} else {
$process = new SymfonyProcess(
$process = SymfonyProcess::fromShellCommandline(
escapeShellArg($cmd) . ' '
. $imagePath . ' -q '
. $this->getRequest()->getParam('quality')
......@@ -159,7 +159,7 @@ class Result extends \Magento\Framework\View\Element\Template
);
}
$process->mustRun();
} catch (SymfonyProcessFailedException $exception) {
} catch (\Throwable $exception) {
$this->error = __('Conversion Failed. Please make sure your custom path and
command are correct and your quality configuration value is between 0 and 100!');
return false;
......@@ -198,7 +198,7 @@ class Result extends \Magento\Framework\View\Element\Template
equals sign (=) and alphanumeric characters.');
return false;
} else {
$process = new SymfonyProcess(
$process = SymfonyProcess::fromShellCommandline(
escapeshellarg($cmd) . ' '
. $imagePath . ' '
. $customCommand . ' '
......@@ -206,7 +206,7 @@ class Result extends \Magento\Framework\View\Element\Template
);
}
} else {
$process = new SymfonyProcess(
$process = SymfonyProcess::fromShellCommandline(
escapeshellarg($cmd) . ' ' . $imagePath
. ' -quality ' . $this->getRequest()->getParam('quality')
. ' -define webp:lossless=false,method=6,segments=4,sns-strength=80,auto-filter=true,'
......@@ -216,7 +216,7 @@ class Result extends \Magento\Framework\View\Element\Template
);
}
$process->mustRun();
} catch (SymfonyProcessFailedException $exception) {
} catch (\Throwable $exception) {
$this->error = __('Conversion Failed. Please make sure your custom path and command are
correct and your quality configuration value is between 0 and 100!');
return false;
......
......@@ -240,7 +240,7 @@ class Data extends AbstractHelper
equals sign (=) and alphanumeric characters.');
return false;
} else {
$process = new SymfonyProcess(
$process = SymfonyProcess::fromShellCommandline(
$this->escapeshellarg($cmd) . ' '
. $imagePath . ' '
. $customCommand . ' '
......@@ -248,7 +248,7 @@ class Data extends AbstractHelper
);
}
} else {
$process = new SymfonyProcess(
$process = SymfonyProcess::fromShellCommandline(
$this->escapeShellArg($cmd) . ' '
. $imagePath
. ' -quality '
......@@ -260,7 +260,7 @@ class Data extends AbstractHelper
);
}
$process->mustRun();
} catch (SymfonyProcessFailedException $exception) {
} catch (\Throwable $exception) {
return $imagePath;
}
......@@ -297,7 +297,7 @@ class Data extends AbstractHelper
underscore (_), minus (-), space ( ) and alphanumeric characters.');
return false;
} else {
$process = new SymfonyProcess(
$process = SymfonyProcess::fromShellCommandline(
$this->escapeshellarg($cmd) . ' '
. $imagePath . ' '
. $customCommand . ' '
......@@ -305,7 +305,7 @@ class Data extends AbstractHelper
);
}
} else {
$process = new SymfonyProcess(
$process = SymfonyProcess::fromShellCommandline(
$this->escapeShellArg($cmd) . ' '
. $imagePath . ' -q '
. $this->imageQuality()
......@@ -315,7 +315,7 @@ class Data extends AbstractHelper
);
}
$process->mustRun();
} catch (SymfonyProcessFailedException $exception) {
} catch (\Throwable $exception) {
return $imagePath;
}
......@@ -458,9 +458,6 @@ class Data extends AbstractHelper
*/
public function getImageUrlFromPath($imagePath)
{
if (empty($imagePath)){
return ;
}
$systemPaths = $this->getSystemPaths();
if (!preg_match('/^http/', $imagePath)) {
foreach ($systemPaths as $systemPath) {
......
......@@ -29,6 +29,13 @@ class ReplaceImageTag
protected $storeManager;
/**
* StoreManagerInterface
*
* @var LoggerInterface
*/
protected $logger;
/**
* Constructor
*
* @param Data $helper
......@@ -58,6 +65,18 @@ class ReplaceImageTag
return $output;
}
//disable convert image in email
$handles = $layout->getUpdate()->getHandles();
if (empty($handles)) {
return $output;
}
foreach ($handles as $handle) {
if (strstr($handle, '_email_')) {
return $output;
}
}
$regex = '/<img([^<]+\s|\s)src=(\"|' . "\')([^<]+?\.(png|jpg|jpeg))[^<]+>(?!(<\/pic|\s*<\/pic))/mi";
if (preg_match_all($regex, $output, $images, PREG_OFFSET_CAPTURE) === false) {
return $output;
......
......@@ -3,7 +3,7 @@
"description": "WebP Optimized Images",
"type": "magento2-module",
"license": "MIT",
"version": "2.1.11",
"version": "2.1.13",
"authors": [
{
"name": "JaJuMa",
......
......@@ -125,7 +125,7 @@
224.517V336H106.692V115.336H74L91.2077 64H158.026V174.716ZM272.988 109.567L286.407
69.7565H239.485L226.132 109.567H272.988ZM235.338 64H294.409L277.112
115.336H218.13L235.338 64Z"></path></svg> Hyvä Theme Demo</a>
<div style="float: right;">Installed Version: <b>2.1.11</b></div>
<div style="float: right;">Installed Version: <b>2.1.13</b></div>
</div>
</div>
<hr>
......@@ -141,24 +141,36 @@
target="_blank">Video Widget</a>
<a href="https://www.jajuma.de/en/jajuma-develop/extensions/page-preload-extension-for-magento-2"
target="_blank">Page Preload</a>
<a href="https://www.jajuma.de/en/jajuma-develop/extensions/matomo-analytics-extension-for-magento-2"
target="_blank">Matomo Analytics</a>
<a href="https://www.jajuma.de/en/jajuma-develop/extensions/honey-spam-anti-spam-extension-for-magento-2"
target="_blank">Honey Spam Anti-Spam</a>
<a href="https://www.jajuma.de/en/jajuma-develop/extensions/matomo-analytics-extension-for-magento-2"
target="_blank">Matomo Analytics</a>
<a href="https://www.jajuma.de/en/jajuma-develop/extensions/customer-registration-reminder-and-cleanup-extension-for-magento-2"
target="_blank">Customer Registration Reminder & Cleanup</a>
<a href="https://www.jajuma.de/en/jajuma-develop/extensions/category-grid-callouts-extension-for-magento-2"
target="_blank">Category Grid Callouts</a>
<a href="https://www.jajuma.de/en/jajuma-develop/extensions/customer-satisfaction-feedback-extension-for-magento-2"
target="_blank">Customer Satisfaction Feedback</a>
<a href="https://www.jajuma.de/en/jajuma-develop/extensions/customer-navigation-manager-extension-for-magento-2"
target="_blank"><b>Free:</b> Customer Navigation Manager</a>
<a href="https://www.jajuma.de/en/jajuma-develop/extensions/auto-select-options-extension-for-magento-2"
target="_blank">Auto Select Options</a>
<a href="https://www.jajuma.de/en/jajuma-develop/extensions/proportional-pro-rata-dynamic-shipping-tax-plus-extension-for-magento-2"
target="_blank">Dynamic Shipping Tax Plus</a>
<a href="https://www.jajuma.de/en/jajuma-develop/extensions/back-forward-cache-extension-for-magento-2"
target="_blank">Back Forward Cache (bfcache)</a>
<a href="https://www.jajuma.de/en/jajuma-develop/extensions/magento-without-elasticsearch-mysql-search-extension-for-magento-2"
target="_blank">MySQL Search</a>
<a href="https://www.jajuma.de/en/jajuma-develop/extensions/resource-hints-preload-critical-resources-assets-extension-for-magento-2"
target="_blank">Preload Critical Resources + Assets</a>
<a href="https://www.jajuma.de/en/jajuma-develop/extensions/font-awesome-icons-for-hyva-themes-extension"
target="_blank"><b>Free:</b> Awesome Hyvä</a>
<a href="https://www.jajuma.de/en/jajuma-develop/extensions/customer-navigation-manager-extension-for-magento-2"
target="_blank"><b>Free:</b> Customer Navigation Manager</a>
<a href="https://www.jajuma.de/en/jajuma-develop/extensions/dynamic-shipping-tax-extension-for-magento-2"
target="_blank"><b>Free:</b> Dynamic Shipping Tax</a>
<a href="https://www.jajuma.de/en/jajuma-develop/extensions/hyva-faq-widget-extension-for-hyva-themes"
target="_blank"><b>Free:</b> Hyvä FAQ Widget</a>
<a href="https://www.jajuma.de/en/jajuma-develop/extensions/hyva-pwa-extension-for-magento-2"
target="_blank"><b>Free:</b> Hyvä PWA</a>
</div>
</div>
<hr>
......@@ -166,6 +178,35 @@
</div>
]]></comment>
</field>
<field id="extension_compat_note" translate="label comment" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1" type="text">
<frontend_model>Jajuma\WebpImages\Block\System\Config\Form\Jajuma\Module</frontend_model>
<comment>
<![CDATA[
<div style="margin:auto;padding:10px;background-color:#f1f1f1;display:inline-block;width:97%;">
<div class="box-img" style="width: 20%;float: left;display: flex;justify-content: flex-end;">
<a href="https://www.jajuma.de/en/jajuma-develop/extensions/resource-hints-preload-critical-resources-assets-extension-for-magento-2"
title="Resource Hints for Magento 2 - Preload Critical Resources + Assets" target="_blank">
<div class="jajuma-extlogo-pcr"></div>
</a>
</div>
<div style="width: 77%;float: left;padding-left: 3%;">
<b>Note:</b><br>This extension is compatible with
<b><a href="https://www.jajuma.de/en/jajuma-develop/extensions/resource-hints-preload-critical-resources-assets-extension-for-magento-2"
title="Resource Hints for Magento 2 - Preload Critical Resources + Assets" target="_blank">
Preload Critical Resources + Assets</a></b><br>
This extensions allows to improve your Core Web Vitals page experience KPIs even further
by using Resource Hints for Preload Critical Resources & Assets incl.
Improved Largest Contentful Paint (LCP) images.<br>
For LCP images the best available image format will be preloaded automatically
(.jpg/.png WebP).<br>
For more details please see the
<b><a href="https://www.jajuma.de/sites/default/files/ckfinder/userfiles/images/jajuma-develop/preload-critical-resources-assets-magento/JaJuMa_Preload_Critical_Resources_And_Assets_v001.pdf"
target="_blank">Manual</a></b>.<br></span>
</div>
</div>
]]>
</comment>
</field>
</group>
<group id="setting" showInDefault="1" showInStore="1" showInWebsite="1" sortOrder="10" translate="label">
<label>General Configuration</label>
......
......@@ -69,6 +69,13 @@ li.item-jajuma-webp-images.parent.level-1 {
height: 185px;
background-size: cover;
}
#webp_extension_info .jajuma-extlogo-pcr {
background-image: url(../images/module-image-pcr.png);
width: 85px;
height: 85px;
background-size: cover;
float: left;
}
.jajuma-minilogo {
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJUAAAAyCAMAAABiZWkrAAAC9FBMVEUAAABrbG+TlZhsbXB7fH6TlZeTlZiTlZhtb3GTlZiTlZhsbXCWmJojHiJtb3Ftb3Fvb3LEw8WTlZiTlZiTlZibnJ4jHyJqa26TlZdrbG9rbG4QCg9ub3JvcHOTlJcpJCiUlZeTlZhub3EdFxxvcHIeGB2TlZiRk5YYERbIycpFQUUkHiOTlZgoIycjHiEwKy+VlpmTlZdwcHMUDxOTlZiRkpUdFxxub3EsJytkZGYmISVCPkJQTE9oaWsrJiptb3FjYWNtbnEZEheTlZhFQUVIREe9vL2ysbOTlZhMSk1tb3FfXmFub3GZmJsnIidvb3I+Oj00MDNGQ0YfGR6TlZgzLjKTlZgZExmSlJdtb3HR0tMkHyNNSUwwKy9OS04ZExlWVlg5NDcWDxRSUFNoaWvR0NE7ODthYWNaWFowKi5EQEMVDhS7uryTlZhlZWgUDRNub3Jub3IKBgmTkpVTUVNrbG+urrHg4eKBfoGzsrTMzM1aWVtdXV8/PUBAPT+GgoVTUVO5uLnLy83Ly8xbWl1QTlFbWlzZ2twQBw7LzM5jYmRUUVTd3t/Q0NJXVFeEg4WNjI6TlZilo6bNztCfnZ8LAgrCwsW0tLfOz9GIhYeBgIN9e36TlZhtb3Fub3I9OT1DP0JMSUxhYGJeXWBWVFdQTVA8Nzu6ubtlZmhZVVhOS05ZV1o1MDSFgYRkY2VJRkmysLOmpKeBfoFcW105NTg3Mza4tritrK6joaOVkpWNio1tbnFaWVtGQkW1s7ZTUFNBPUAoIyebmJuLh4p1cHNUUVRPTE9AOz8tKCyqqaygnqCem56YlZiRjpGIhId6dnlpaWtiYmRLR0rIyMrGxsjEw8V+en1xbHBrZ2tEQUQxLDAbFRrKy8y8u71dWFxUU1VST1JRT1E+Oz69vb6pp6pHRUcgGh/e3+DO0NHAwMKurrBuaW1HREfMzc++vsB3c3dra25oY2cWEBVzdHbh4uRgXWARCQ/Q0dKsqqzX2NrT1dYHAgUdpgluAAAAnHRSTlMAFZ0aBa2KjyjKwFNL/urfe3FvPCsUEgnvknNsRD02JQz569OZfHtjNzQjIR8aDOLSc2JYUUcu+vny6tfPzs7Ds6mYlY92clJBOfPw5t/e0cq3sqyooY2JhGhlZWNaUEpHRT40Mx718vDu5+fJxcLCs7GppYmFg314aEYk8vLx7+3r6eTg3drY0tHPysfDw8GzsbCgn5GQg2pTOyHOcvy+AAAH5ElEQVRYw82XZVSTYRTHr87G7u7u7u7u7u7u7u7ONxcvK5gskTG3AdvAgg2UmCKghIrd+sXn3ZyFMTw6+J3DOfc8fOB37v8+93mBPzB9r8/B3jkge9E9JeV6qjrsSD/IRiwvFBeKparV6itDso9Xd2Mco7yaeueyxu+q/HB9+Pfk+lqh0i1qhUrJ9Ngrrx54X7wfdEn+elQucJc6WO0MZ32xvPA93QiikrOqVBjvAm4xQaViZALaL/XmPbXGL+hGONcyAdwkN5Ynw1leLCd8R442WmKps+yC40XAHVowpDJZL7oblhrFNuvqJZ+QeGZw3e/6v2Fq+XJdF3fq1KnLslVTM2+Fa/sT+diqIlEEHwhuMIkyKNMTJTxJWOpttln+QQG3okVMoRpVgKX+5F7DO27lB/K4vr7CiIhnQm7wup9ZVc31O6uBRYmajijx8m2qg4MyZcBFqXrr+yAKVppRv36jRo0a1G0xIkFvMQgkXKHi4avbbLP8/K/eiObPHlzIXqPW8KHzxXR6Mi0w8RVISyiMEPoGXC6W0SoPhmFNS35r1bDpCrZuVrYvsiIIzhCCA5APX8rBHVYVixB4m/KomLXm0I7Im0+8L78LCpBHi2xMW6P9jZHqeGAunx9oDZQhq8ioJ9sWnizqNaN+Y4ApTZJoMaWUktQ3WkK5/8XeGawWYVj+QVjZUt9Y9cXys3UBrCDbKwK88KIA5fBKgBdGx821eJEhhLYoHL384VVq5D1vddh1nxBuvMASZ0zpXqUxOzUXztdZOzbP6jXj19eb9e31qzKMkhlUqqRYmTjhrkjBs/paHwX7Z+xVM6xpLrYs/o1Vie+tygCOA6CZ4hDIioPjXqhfaPA36RIeaV69VYcF+MhjJKJ0qbFzA/gDyEtnoyxJlEyceFei4EXEx1zyU2ewWoS1BNYt56+sCJwDq/CZXsQ4FGJhtlXLAJAgDnPNZKFQkXfqFRRfDFfAtJ0E7tB6qMxGoW4J9HyJL99869p97wxWZTF2pIr/2grXcqAqXqRI/1xOq/LamsAe47CRL7Cp3oT6aAJuPLIqDKMag5tM6yAWU5RNoJcoLCKfa5o7P1rlqoasft8rZAXltHh5NPDstBclyoFz3AZI9DRF2j/evSIPEXVoDYhMeJmTZQKeQRVzIyijVdVqn3vVAxyMzmClZa04OJEDnL0qqnVYEW1gjoJv1pGqlBeWpzG9IJNMG06b9bRRFx0c9O6HBMe6elUHlb+6gziH3QaVwGWFO636wxyeKDHZoAq1v5jXCDJP/ZW7Q+3ikOCrGpdVKXYR5GcvXlOslUOgNlRlz0aiAipjZdG9LFnty7SzuKzG4d3Y9UAUgXa8QL2NUoUiasHfUCVFFR8iv3T/8ud9dQwrgVLDGgL0wPJXblYNQy0ajW5jS4yVrFoWy1kyJ4ZlsCLQXFUi8HGVuhB4ddbqLp2kJA1JKukY+AtqpYiCL/n7vXNt0RLIA2PbAg3LoqJAZayAs3LOVx3Hb1siTXa3f7Vy7PaaOI5rvWri0I4bmGizJSboGIZUVYBM0yglLv6G/5O3j/fNcj1ftUeOruys6hRHReUSqEXFR/ZoBQ5KFq+D+tgK/ZTx8nI9eqiu6HhxyqOjHBVRr/h8BTdQIKNUjEE6BTLLGCNpCg9ueqYe/EsG8KwREdzAu4JkUpmkk7aGzFH3TaFhEydz4B/TSYs/E/ryJCYxxagoXZPS4D6lJ/VsYl8O/4N8XujLbf8AUSJN0zabpTO4Sb+eQ5WMNG5Bafh/5OLMmDp5Yq9ePUNrtG7w5z+0YeWudNKiVEmNFcATTPn4IkU6v2PXmkWbn6tcCn7KzK4SE50ey5CMtAZ4hgpvXhSSUvzn0bd8Ai4NOr56Xb2qPzgttir4iTIZSRqUoRXAQ5x6YS9Emk3Pn966cf3aFb+Hl70Xnh7/5eLn6Bbhi66sWafU2UjUKo+x5IU9ziJ4/ShcHnwpyD/sovrOg6jI7SccZs2fRThubHKsgLYo4yqAxyi9wG4kxaKYEDbDq36ai+p7NyMjH6el7TlbU4isuAq+2KyXGRjlYPAcaDXa43QJ8Y+eytkM76MMn9yMvP047X3aS192uQWa9GZKRzHSCuBJWqCBF79+Hh3u8zVDpPU+LdzqCFAvo8RUEtm+MXiUMfZQRsxlM7x+jc3Q+97NKNbqpTXCFwVImxMslEVaCzzMiBSpTs+NfioPvh7kjzK88wBl+OHxS66jVfwEUqYj25cGT7PEqBTEPw8JZwceZeiNMrz9lrWyKkQSc5IgnUGt8jhlasQxIl+UoWtpoXv49vZLLlpWInGyKZZkp8rzNGpPGkQx6B66Bv5JVFrkS54VfVGb9YZYEu2qrKC1USeLj3Fm6Bz4tCiCh14bk4CkSaYJZA11jWLTa9fS0qCldTuKUKDXRhybaFEqW0AWMd1ociytgM8ZRt3EA3mSRDrBoIwdAVkF0hI9f44GPsA58DefaCUKvoA2MLa2DSDrqNuWHXjX0npw75kEfS7EUnRcC8hKGsyLj452Dvy7i/fuPOOLEuhYnbQ7ZC2NO8eHfF5aGm/viLt89n+0zpDljJKEhzsyDFNfFiaaxOlJ6B+hrGcC/5bcJwC90hcvCgUJNDW7CmQHGnS85cNmqNFYxYLkzdlDCjGR/dK6ej+MS9MdskN8LtZuCbjm78eT9YTsRasVg67s7Aee4BNQRVdPw98EhgAAAABJRU5ErkJggg==');
width: 75px;
......
/*! modernizr 3.6.0 (Custom Build) | MIT *
* https://modernizr.com/download/?-webp-setclasses !*/
!function(e,n,A){function o(e,n){return typeof e===n}function t(){var e,n,A,t,a,i,l;for(var f in r)if(r.hasOwnProperty(f)){if(e=[],n=r[f],n.name&&(e.push(n.name.toLowerCase()),n.options&&n.options.aliases&&n.options.aliases.length))for(A=0;A<n.options.aliases.length;A++)e.push(n.options.aliases[A].toLowerCase());for(t=o(n.fn,"function")?n.fn():n.fn,a=0;a<e.length;a++)i=e[a],l=i.split("."),1===l.length?ModernizrJajuma[l[0]]=t:(!ModernizrJajuma[l[0]]||ModernizrJajuma[l[0]]instanceof Boolean||(ModernizrJajuma[l[0]]=new Boolean(ModernizrJajuma[l[0]])),ModernizrJajuma[l[0]][l[1]]=t),s.push((t?"":"no-")+l.join("-"))}}function a(e){var n=u.className,A=ModernizrJajuma._config.classPrefix||"";if(c&&(n=n.baseVal),ModernizrJajuma._config.enableJSClass){var o=new RegExp("(^|\\s)"+A+"no-js(\\s|$)");n=n.replace(o,"$1"+A+"js$2")}ModernizrJajuma._config.enableClasses&&(n+=" "+A+e.join(" "+A),c?u.className.baseVal=n:u.className=n)}function i(e,n){if("object"==typeof e)for(var A in e)f(e,A)&&i(A,e[A]);else{e=e.toLowerCase();var o=e.split("."),t=ModernizrJajuma[o[0]];if(2==o.length&&(t=t[o[1]]),"undefined"!=typeof t)return ModernizrJajuma;n="function"==typeof n?n():n,1==o.length?ModernizrJajuma[o[0]]=n:(!ModernizrJajuma[o[0]]||ModernizrJajuma[o[0]]instanceof Boolean||(ModernizrJajuma[o[0]]=new Boolean(ModernizrJajuma[o[0]])),ModernizrJajuma[o[0]][o[1]]=n),a([(n&&0!=n?"":"no-")+o.join("-")]),ModernizrJajuma._trigger(e,n)}return ModernizrJajuma}var s=[],r=[],l={_version:"3.6.0",_config:{classPrefix:"",enableClasses:!0,enableJSClass:!0,usePrefixes:!0},_q:[],on:function(e,n){var A=this;setTimeout(function(){n(A[e])},0)},addTest:function(e,n,A){r.push({name:e,fn:n,options:A})},addAsyncTest:function(e){r.push({name:null,fn:e})}},ModernizrJajuma=function(){};ModernizrJajuma.prototype=l,ModernizrJajuma=new ModernizrJajuma;var f,u=n.documentElement,c="svg"===u.nodeName.toLowerCase();!function(){var e={}.hasOwnProperty;f=o(e,"undefined")||o(e.call,"undefined")?function(e,n){return n in e&&o(e.constructor.prototype[n],"undefined")}:function(n,A){return e.call(n,A)}}(),l._l={},l.on=function(e,n){this._l[e]||(this._l[e]=[]),this._l[e].push(n),ModernizrJajuma.hasOwnProperty(e)&&setTimeout(function(){ModernizrJajuma._trigger(e,ModernizrJajuma[e])},0)},l._trigger=function(e,n){if(this._l[e]){var A=this._l[e];setTimeout(function(){var e,o;for(e=0;e<A.length;e++)(o=A[e])(n)},0),delete this._l[e]}},ModernizrJajuma._q.push(function(){l.addTest=i}),ModernizrJajuma.addAsyncTest(function(){function e(e,n,A){function o(n){var o=n&&"load"===n.type?1==t.width:!1,a="webp"===e;i(e,a&&o?new Boolean(o):o),A&&A(n)}var t=new Image;t.onerror=o,t.onload=o,t.src=n}var n=[{uri:"data:image/webp;base64,UklGRiQAAABXRUJQVlA4IBgAAAAwAQCdASoBAAEAAwA0JaQAA3AA/vuUAAA=",name:"webp"},{uri:"data:image/webp;base64,UklGRkoAAABXRUJQVlA4WAoAAAAQAAAAAAAAAAAAQUxQSAwAAAABBxAR/Q9ERP8DAABWUDggGAAAADABAJ0BKgEAAQADADQlpAADcAD++/1QAA==",name:"webp.alpha"},{uri:"data:image/webp;base64,UklGRlIAAABXRUJQVlA4WAoAAAASAAAAAAAAAAAAQU5JTQYAAAD/////AABBTk1GJgAAAAAAAAAAAAAAAAAAAGQAAABWUDhMDQAAAC8AAAAQBxAREYiI/gcA",name:"webp.animation"},{uri:"data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA=",name:"webp.lossless"}],A=n.shift();e(A.name,A.uri,function(A){if(A&&"load"===A.type)for(var o=0;o<n.length;o++)e(n[o].name,n[o].uri)})}),t(),a(s),delete l.addTest,delete l.addAsyncTest;for(var p=0;p<ModernizrJajuma._q.length;p++)ModernizrJajuma._q[p]();e.ModernizrJajuma=ModernizrJajuma}(window,document);
\ No newline at end of file
!function(e,n,A){function o(e,n){return typeof e===n}function t(){var e,n,A,t,a,i,l;for(var f in r)if(r.hasOwnProperty(f)){if(e=[],n=r[f],n.name&&(e.push(n.name.toLowerCase()),n.options&&n.options.aliases&&n.options.aliases.length))for(A=0;A<n.options.aliases.length;A++)e.push(n.options.aliases[A].toLowerCase());for(t=o(n.fn,"function")?n.fn():n.fn,a=0;a<e.length;a++)i=e[a],l=i.split("."),1===l.length?ModernizrJajuma[l[0]]=t:(!ModernizrJajuma[l[0]]||ModernizrJajuma[l[0]]instanceof Boolean||(ModernizrJajuma[l[0]]=new Boolean(ModernizrJajuma[l[0]])),ModernizrJajuma[l[0]][l[1]]=t),s.push((t?"":"no-")+l.join("-"))}}function a(e){var n=u.className,A=ModernizrJajuma._config.classPrefix||"";if(c&&(n=n.baseVal),ModernizrJajuma._config.enableJSClass){var o=new RegExp("(^|\\s)"+A+"no-js(\\s|$)");n=n.replace(o,"$1"+A+"js$2")}ModernizrJajuma._config.enableClasses&&(n+=" "+A+e.join(" "+A),c?u.className.baseVal=n:u.className=n)}function i(e,n){if("object"==typeof e)for(var A in e)f(e,A)&&i(A,e[A]);else{e=e.toLowerCase();var o=e.split("."),t=ModernizrJajuma[o[0]];if(2==o.length&&(t=t[o[1]]),"undefined"!=typeof t)return ModernizrJajuma;n="function"==typeof n?n():n,1==o.length?ModernizrJajuma[o[0]]=n:(!ModernizrJajuma[o[0]]||ModernizrJajuma[o[0]]instanceof Boolean||(ModernizrJajuma[o[0]]=new Boolean(ModernizrJajuma[o[0]])),ModernizrJajuma[o[0]][o[1]]=n),a([(n&&0!=n?"":"no-")+o.join("-")]),ModernizrJajuma._trigger(e,n)}return ModernizrJajuma}var s=[],r=[],l={_version:"3.6.0",_config:{classPrefix:"",enableClasses:!0,enableJSClass:!0,usePrefixes:!0},_q:[],on:function(e,n){var A=this;setTimeout(function(){n(A[e])},0)},addTest:function(e,n,A){r.push({name:e,fn:n,options:A})},addAsyncTest:function(e){r.push({name:null,fn:e})}},ModernizrJajuma=function(){};ModernizrJajuma.prototype=l,ModernizrJajuma=new ModernizrJajuma;var f,u=n.documentElement,c="svg"===u.nodeName.toLowerCase();!function(){var e={}.hasOwnProperty;f=o(e,"undefined")||o(e.call,"undefined")?function(e,n){return n in e&&o(e.constructor.prototype[n],"undefined")}:function(n,A){return e.call(n,A)}}(),l._l={},l.on=function(e,n){this._l[e]||(this._l[e]=[]),this._l[e].push(n),ModernizrJajuma.hasOwnProperty(e)&&setTimeout(function(){ModernizrJajuma._trigger(e,ModernizrJajuma[e])},0)},l._trigger=function(e,n){if(this._l[e]){var A=this._l[e];setTimeout(function(){var e,o;for(e=0;e<A.length;e++)(o=A[e])(n)},0),delete this._l[e]}},ModernizrJajuma._q.push(function(){l.addTest=i}),ModernizrJajuma.addAsyncTest(function(){function e(e,n,A){function o(n){var o=n&&"load"===n.type?1==t.width:!1,a="webp"===e;i(e,a&&o?new Boolean(o):o),A&&A(n)}var t=new Image;t.onerror=o,t.onload=o,t.src=n}var n=[{uri:"data:image/webp;base64,UklGRiQAAABXRUJQVlA4IBgAAAAwAQCdASoBAAEAAwA0JaQAA3AA/vuUAAA=",name:"webp"}],A=n.shift();e(A.name,A.uri,function(A){if(A&&"load"===A.type)for(var o=0;o<n.length;o++)e(n[o].name,n[o].uri)})}),t(),a(s),delete l.addTest,delete l.addAsyncTest;for(var p=0;p<ModernizrJajuma._q.length;p++)ModernizrJajuma._q[p]();e.ModernizrJajuma=ModernizrJajuma}(window,document);
\ No newline at end of file
......@@ -101,9 +101,10 @@ define([
});
} else {
context.find(this.options.mediaGallerySelector).on('gallery:loaded', function (loadedGallery) {
loadedGallery = context.find(this.options.mediaGallerySelector).data('gallery');
loadedGallery.updateData(imagesToUpdate);
this.updateBaseImage(images, context, isInProductView);
}.bind(this));
return;
}
if (isInitial) {
......
# Magento_AwsS3PageBuilder module
The Magento_AwsS3PageBuilder module created for maintaining Page Builder tests related to Aws S3 remote storage functionality
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<suites xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Suite/etc/suiteSchema.xsd">
<suite name="RemoteStorageAwsS3EnabledPageBuilderSuite">
<before>
<magentoCLI command="setup:config:set {{RemoteStorageAwsS3ConfigData.enable_options}}" stepKey="enableRemoteStorage"/>
<magentoCLI command="config:set cms/pagebuilder/enabled 1" stepKey="enablePageBuilder"/>
<magentoCLI command="config:set cms/wysiwyg/enabled enabled" stepKey="enableWYSIWYG"/>
<actionGroup ref="CliEnableTinyMCEActionGroup" stepKey="enableTinyMCE" >
<argument name="TinyMCEValue" value="{{EnableTinyMCE.value}}"/>
</actionGroup>
<magentoCLI command="config:set cms/pagebuilder/google_maps_api_key ''" stepKey="setEmptyGoogleMapsAPIKey"/>
<magentoCLI command="config:set web/default_layouts/default_cms_layout cms-full-width" stepKey="setPageBuilderDefaultCmsLayout"/>
<magentoCLI command="config:set web/default_layouts/default_category_layout category-full-width" stepKey="setPageBuilderDefaultCategoryLayout"/>
<magentoCLI command="config:set web/default_layouts/default_product_layout product-full-width" stepKey="setPageBuilderDefaultProductLayout"/>
<magentoCLI command="cache:clean config" stepKey="flushCache"/>
</before>
<after>
<magentoCLI command="setup:config:set {{RemoteStorageAwsS3ConfigData.disable_options}}" stepKey="disableRemoteStorage"/>
<magentoCLI command="config:set cms/pagebuilder/enabled 1" stepKey="enablePageBuilder"/>
<actionGroup ref="CliEnableTinyMCEActionGroup" stepKey="enableTinyMCE" >
<argument name="TinyMCEValue" value="{{EnableTinyMCE.value}}"/>
</actionGroup>
<magentoCLI command="config:set cms/wysiwyg/enabled disabled" stepKey="disableWYSIWYG"/>
<magentoCLI command="config:set cms/pagebuilder/google_maps_api_key ''" stepKey="setEmptyGoogleMapsAPIKey"/>
<magentoCLI command="cache:clean config" stepKey="flushCache"/>
</after>
<include>
<group name="remote_storage_aws_s3_pagebuilder"/>
</include>
</suite>
</suites>
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
<test name="ImageAddImageContentTypeToCMSPageAwsS3Test" extends="ImageAddImageContentTypeToCMSPageTest">
<annotations>
<features value="PageBuilder"/>
<stories value="Image"/>
<title value="Add Image in PageBuilder for new CMS page with Aws S3 enabled and view on Storefront"/>
<description value="A user should be able to add an image into a row."/>
<severity value="BLOCKER"/>
<useCaseId value="MAGETWO-83926"/>
<testCaseId value="MC-2694"/>
<group value="pagebuilder"/>
<group value="pagebuilder-image"/>
<group value="remote_storage_aws_s3"/>
<group value="skip_in_cloud_native_s3"/>
<group value="remote_storage_aws_s3_pagebuilder"/>
</annotations>
<before>
<comment userInput="BIC workaround" stepKey="enableRemoteStorage"/>
</before>
<after>
<comment userInput="BIC workaround" stepKey="disableRemoteStorage"/>
</after>
</test>
</tests>
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
<test name="AwsS3ImageAddImageIntoPageBuilderStageTest" extends="ImageAddImageIntoPageBuilderStageTest">
<annotations>
<features value="PageBuilder"/>
<stories value="Image"/>
<title value="Add Image via Page Builder with Aws S3 Filestorage enabled"/>
<description value="Upload and select images to/from Magento Media Gallery from the Image content type in the Page Builder Stage."/>
<severity value="BLOCKER"/>
<useCaseId value="MAGETWO-71618"/>
<testCaseId value="MC-1334"/>
<group value="pagebuilder"/>
<group value="pagebuilder-image"/>
<group value="remote_storage_aws_s3"/>
<group value="skip_in_cloud_native_s3"/>
<group value="remote_storage_aws_s3_pagebuilder"/>
</annotations>
<before>
<comment userInput="BIC workaround" stepKey="enableRemoteStorage"/>
</before>
<after>
<comment userInput="BIC workaround" stepKey="disableRemoteStorage"/>
</after>
</test>
</tests>
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
<test name="AwsS3ImageInvalidFileTypeValidationTest" extends="ImageInvalidFileTypeValidationTest">
<annotations>
<features value="PageBuilder"/>
<stories value="Image"/>
<title value="Image Invalid File Type Upload validation with Aws S3 Filestorage enabled"/>
<description value="Tests that the Image Validation functions as expected for invalid file type"/>
<severity value="MAJOR"/>
<group value="pagebuilder"/>
<group value="pagebuilder-image"/>
<group value="remote_storage_aws_s3"/>
<group value="skip_in_cloud_native_s3"/>
<group value="remote_storage_aws_s3_pagebuilder"/>
</annotations>
<before>
<comment userInput="BIC workaround" stepKey="enableRemoteStorage"/>
</before>
<after>
<comment userInput="BIC workaround" stepKey="disableRemoteStorage"/>
</after>
</test>
</tests>
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
<test name="AwsS3ImageRemoveImageFromStageTest" extends="ImageRemoveImageFromStageTest">
<annotations>
<features value="PageBuilder"/>
<stories value="Image"/>
<title value="Delete Image via Page Builder with Aws S3 Filestorage enabled"/>
<description value="A user should be able to remove image type from a row."/>
<severity value="CRITICAL"/>
<useCaseId value="MAGETWO-83926"/>
<testCaseId value="MC-4022"/>
<group value="pagebuilder"/>
<group value="pagebuilder-image"/>
<group value="remote_storage_aws_s3"/>
<group value="skip_in_cloud_native_s3"/>
<group value="remote_storage_aws_s3_pagebuilder"/>
</annotations>
<before>
<comment userInput="BIC workaround" stepKey="enableRemoteStorage"/>
</before>
<after>
<comment userInput="BIC workaround" stepKey="disableRemoteStorage"/>
</after>
</test>
</tests>
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
<test name="AwsS3PageBuilderCreateTemplateOnCMSBlockForPageAndApplyTemplateToCatalogCategory" extends="PageBuilderCreateTemplateOnCMSBlockForPageAndApplyTemplateToCatalogCategory">
<annotations>
<features value="PageBuilder"/>
<stories value="Templates"/>
<title value="Create Template on CMS Block for a page and Apply Template to Catalog Category with Aws S3 filestorage enabled"/>
<description value="Verify that a user can create a Page Builder template on the CMS Block stage for a page and apply this template to a Catalog Category."/>
<severity value="CRITICAL"/>
<useCaseId value="PB-341"/>
<testCaseId value="MC-30724"/>
<group value="pagebuilder"/>
<group value="pagebuilder-templates"/>
<group value="pagebuilder-cms-block"/>
<group value="pagebuilder-cms-category"/>
<group value="remote_storage_aws_s3"/>
<group value="skip_in_cloud_native_s3"/>
<group value="remote_storage_aws_s3_pagebuilder"/>
</annotations>
<before>
<comment userInput="BIC workaround" stepKey="enableRemoteStorage"/>
</before>
<after>
<comment userInput="BIC workaround" stepKey="disableRemoteStorage"/>
</after>
</test>
</tests>
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
<test name="AwsS3PageBuilderDeleteTemplate" extends="PageBuilderDeleteTemplate">
<annotations>
<features value="PageBuilder"/>
<stories value="Templates"/>
<title value="Delete Page Builder Template and Validate Grid Data with Aws S3 Fielstorage enabled"/>
<description value="Verify that when a user deletes a template, the template is removed from the template grids."/>
<severity value="CRITICAL"/>
<useCaseId value="PB-341"/>
<testCaseId value="MC-30593"/>
<group value="pagebuilder"/>
<group value="pagebuilder-templates"/>
<group value="remote_storage_aws_s3"/>
<group value="skip_in_cloud_native_s3"/>
<group value="remote_storage_aws_s3_pagebuilder"/>
</annotations>
<before>
<comment userInput="BIC workaround" stepKey="enableRemoteStorage"/>
</before>
<after>
<comment userInput="BIC workaround" stepKey="disableRemoteStorage"/>
</after>
</test>
</tests>
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
<test name="AwsS3PageBuilderVerifySaveContentAsTemplateModalAndApplyTemplateSlideOut" extends="PageBuilderVerifySaveContentAsTemplateModalAndApplyTemplateSlideOut">
<annotations>
<features value="PageBuilder"/>
<stories value="Templates"/>
<title value="Verify Save Content as Template Modal and Apply Template Slide Out With Aws S3 Filestorage enabled"/>
<description value="Verify the functionality and content of the Save Content as Template modal and the Apply Template slide out."/>
<severity value="AVERAGE"/>
<useCaseId value="PB-341"/>
<testCaseId value="MC-30619"/>
<group value="pagebuilder"/>
<group value="pagebuilder-templates"/>
<group value="remote_storage_aws_s3"/>
<group value="skip_in_cloud_native_s3"/>
<group value="remote_storage_aws_s3_pagebuilder"/>
</annotations>
<before>
<comment userInput="BIC workaround" stepKey="enableRemoteStorage"/>
</before>
<after>
<comment userInput="BIC workaround" stepKey="disableRemoteStorage"/>
</after>
</test>
</tests>
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
<test name="AwsS3CanAddVideoToColumnTest" extends="CanAddVideoToColumnTest">
<annotations>
<features value="PageBuilder"/>
<stories value="Video"/>
<title value="Add Video to Column container and view on Admin and Storefront with Aws S3 Filestorage enabled"/>
<description value="As a Content Manager I want column to be a container so that I can add video inside the column"/>
<severity value="BLOCKER"/>
<useCaseId value="MAGETWO-87081"/>
<testCaseId value="MC-2494"/>
<group value="pagebuilder"/>
<group value="pagebuilder-column"/>
<group value="pagebuilder-video"/>
<group value="remote_storage_aws_s3"/>
<group value="skip_in_cloud_native_s3"/>
<group value="remote_storage_aws_s3_pagebuilder"/>
</annotations>
<before>
<comment userInput="BIC workaround" stepKey="enableRemoteStorage"/>
</before>
<after>
<comment userInput="BIC workaround" stepKey="disableRemoteStorage"/>
</after>
</test>
</tests>
{
"name": "magento/module-aws-s3-page-builder",
"description": "Aws S3 Page Builder module",
"type": "magento2-module",
"license": [
"proprietary"
],
"version": "1.0.2",
"require": {
"magento/framework": "103.0.*",
"php": "~7.4.0||~8.1.0"
},
"suggest": {
"magento/module-page-builder": "2.2.*",
"magento/module-aws-s3": "100.4.*"
},
"autoload": {
"files": [
"registration.php"
],
"psr-4": {
"Magento\\AwsS3PageBuilder\\": ""
}
}
}
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Magento_AwsS3PageBuilder">
<sequence>
<module name="Magento_AwsS3"/>
<module name="Magento_PageBuilder"/>
</sequence>
</module>
</config>
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
use \Magento\Framework\Component\ComponentRegistrar;
ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_AwsS3PageBuilder', __DIR__);
# Magento_CatalogPageBuilderAnalytics module
The Magento_CatalogPageBuilderAnalytics module configures data definitions for a data collection related to the PageBuilder module entities to be used in [Advanced Reporting](https://devdocs.magento.com/guides/v2.4/advanced-reporting/modules.html).
{
"name": "magento/module-catalog-page-builder-analytics",
"description": "Catalog Page Builder Analytics module",
"type": "magento2-module",
"license": [
"proprietary"
],
"config": {
"sort-packages": true
},
"version": "1.6.2",
"require": {
"magento/module-page-builder-analytics": "1.6.*",
"magento/module-catalog": "104.0.*",
"magento/framework": "103.0.*",
"php": "~7.4.0||~8.1.0"
},
"autoload": {
"files": [
"registration.php"
],
"psr-4": {
"Magento\\CatalogPageBuilderAnalytics\\": ""
}
}
}
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Analytics:etc/analytics.xsd">
<file name="pagebuilder_category">
<providers>
<reportProvider name="pagebuilder_category" class="Magento\PageBuilderAnalytics\Model\ContentTypeUsageReportProvider">
<parameters>
<name>pagebuilder_category</name>
</parameters>
</reportProvider>
</providers>
</file>
<file name="pagebuilder_product_attributes">
<providers>
<reportProvider name="pagebuilder_product_attributes" class="Magento\PageBuilderAnalytics\Model\ContentTypeUsageReportProvider">
<parameters>
<name>pagebuilder_product_attributes</name>
</parameters>
</reportProvider>
</providers>
</file>
</config>
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Magento_CatalogPageBuilderAnalytics">
<sequence>
<module name="Magento_Catalog"/>
</sequence>
</module>
</config>
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Analytics:etc/reports.xsd">
<report name="pagebuilder_category" connection="default">
<source name="catalog_category_entity_text">
<attribute name="value" alias="content"/>
<link-source name="eav_attribute" link-type="inner">
<using glue="and">
<condition attribute="attribute_id" operator="eq" type="identifier">attribute_id</condition>
<condition attribute="attribute_code" operator="eq">description</condition>
</using>
</link-source>
<link-source name="catalog_category_entity" link-type="inner">
<using glue="and">
<condition attribute="entity_id" operator="eq" type="identifier">entity_id</condition>
</using>
</link-source>
<filter glue="and">
<condition attribute="store_id" operator="in">0,1</condition>
</filter>
</source>
</report>
<report name="pagebuilder_product_attributes" connection="default">
<source name="catalog_product_entity_text">
<attribute name="value" alias="content"/>
<link-source name="eav_attribute" link-type="inner">
<attribute name="attribute_code"/>
<using glue="and">
<condition attribute="attribute_id" operator="eq" type="identifier">attribute_id</condition>
</using>
</link-source>
<link-source name="catalog_eav_attribute" link-type="inner">
<using glue="and">
<condition attribute="attribute_id" operator="eq" type="identifier">attribute_id</condition>
<condition attribute="is_pagebuilder_enabled" operator="eq">1</condition>
</using>
</link-source>
<link-source name="catalog_product_entity" link-type="inner">
<using glue="and">
<condition attribute="entity_id" operator="eq" type="identifier">entity_id</condition>
</using>
</link-source>
<link-source name="catalog_product_super_link" link-type="left">
<using glue="and">
<condition attribute="product_id" operator="eq" type="identifier">entity_id</condition>
</using>
<filter glue="and">
<condition attribute="link_id" operator="null" />
</filter>
</link-source>
<filter glue="and">
<condition attribute="store_id" operator="in">0,1</condition>
</filter>
</source>
</report>
</config>
\ No newline at end of file
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
use \Magento\Framework\Component\ComponentRegistrar;
ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_CatalogPageBuilderAnalytics', __DIR__);
# Magento_CmsPageBuilderAnalytics module
The Magento_CmsPageBuilderAnalytics module configures data definitions for a data collection related to the PageBuilder module entities to be used in [Advanced Reporting](https://devdocs.magento.com/guides/v2.4/advanced-reporting/modules.html).
{
"name": "magento/module-cms-page-builder-analytics",
"description": "CMS Page Builder Analytics module",
"type": "magento2-module",
"license": [
"proprietary"
],
"config": {
"sort-packages": true
},
"version": "1.6.2",
"require": {
"magento/module-page-builder-analytics": "1.6.*",
"magento/module-cms": "104.0.*",
"magento/framework": "103.0.*",
"php": "~7.4.0||~8.1.0"
},
"autoload": {
"files": [
"registration.php"
],
"psr-4": {
"Magento\\CmsPageBuilderAnalytics\\": ""
}
}
}
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Analytics:etc/analytics.xsd">
<file name="pagebuilder_page">
<providers>
<reportProvider name="pagebuilder_page" class="Magento\PageBuilderAnalytics\Model\ContentTypeUsageReportProvider">
<parameters>
<name>pagebuilder_page</name>
</parameters>
</reportProvider>
</providers>
</file>
<file name="pagebuilder_block">
<providers>
<reportProvider name="pagebuilder_block" class="Magento\PageBuilderAnalytics\Model\ContentTypeUsageReportProvider">
<parameters>
<name>pagebuilder_block</name>
</parameters>
</reportProvider>
</providers>
</file>
</config>
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Magento_CmsPageBuilderAnalytics">
<sequence>
<module name="Magento_Cms"/>
</sequence>
</module>
</config>
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Analytics:etc/reports.xsd">
<report name="pagebuilder_page" connection="default">
<source name="cms_page">
<attribute name="content"/>
<link-source name="cms_page_store" link-type="inner">
<using glue="and">
<condition attribute="page_id" operator="eq" type="identifier">page_id</condition>
<condition attribute="store_id" operator="in">0,1</condition>
</using>
</link-source>
</source>
</report>
<report name="pagebuilder_block" connection="default">
<source name="cms_block">
<attribute name="content"/>
<link-source name="cms_block_store" link-type="inner">
<using glue="and">
<condition attribute="block_id" operator="eq" type="identifier">block_id</condition>
<condition attribute="store_id" operator="in">0,1</condition>
</using>
</link-source>
</source>
</report>
</config>
\ No newline at end of file
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
use \Magento\Framework\Component\ComponentRegistrar;
ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_CmsPageBuilderAnalytics', __DIR__);
# Magento_PageBuilderAdminAnalytics module
The Magento_PageBuilderAdminAnalytics module tracks Page Builder information through AdminAnalytics.
{
"name": "magento/module-page-builder-admin-analytics",
"description": "Page Builder Admin Analytics module",
"type": "magento2-module",
"license": [
"proprietary"
],
"config": {
"sort-packages": true
},
"version": "1.1.2",
"require": {
"magento/framework": "103.0.*",
"php": "~7.4.0||~8.1.0"
},
"suggest": {
"magento/module-admin-analytics": "100.4.*",
"magento/module-page-builder": "2.2.*"
},
"autoload": {
"files": [
"registration.php"
],
"psr-4": {
"Magento\\PageBuilderAdminAnalytics\\": ""
}
}
}
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Magento_PageBuilderAdminAnalytics">
<sequence>
<module name="Magento_AdminAnalytics"/>
<module name="Magento_PageBuilder"/>
</sequence>
</module>
</config>
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
use \Magento\Framework\Component\ComponentRegistrar;
ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_PageBuilderAdminAnalytics', __DIR__);
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
var config = {
config: {
mixins: {
'Magento_PageBuilder/js/events': {
'Magento_PageBuilderAdminAnalytics/js/page-builder/events-mixin': true
}
}
}
};
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
define(['underscore'], function (_) {
'use strict';
return {
/**
* Sets up event attributes and action depending on name and args
*
* @param {String} name
* @param {Array} args
*/
build: function (name, args) {
var action = '',
eventAttributes = {},
event;
if (_.isUndefined(args)) {
return;
}
switch (name) {
case 'contentType:duplicateAfter':
action = 'duplicate';
break;
case 'contentType:removeAfter':
action = 'remove';
break;
case 'contentType:createAfter':
action = 'create';
break;
case 'contentType:editBefore':
action = 'edit';
break;
case 'contentType:visibilityAfter':
action = args.visibility ? 'show' : 'hide';
break;
default:
break;
}
if (!_.isUndefined(args.contentType)) {
eventAttributes = args.contentType.config;
} else if (!_.isUndefined(args.originalContentType)) {
eventAttributes = args.originalContentType.config;
}
if (action !== '' && !_.isEmpty(eventAttributes)) {
event = {
element: eventAttributes.label,
type: eventAttributes.name,
action: action,
widget: {
name: eventAttributes.form,
type: eventAttributes['menu_section']
},
feature: 'page-builder-tracker'
};
}
return event;
}
};
});
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
define(['underscore', 'Magento_PageBuilderAdminAnalytics/js/page-builder/event-builder'],
function (_, EventBuilder) {
'use strict';
return function (target) {
var originalTarget = target.trigger,
isAdminAnalyticsEnabled,
event,
hasPageBuilderBeenUsed = false,
delayedPush;
/**
* Invokes custom code to track information regarding Page Builder usage
*
* @param {String} name
* @param {Array} args
*/
target.trigger = function (name, args) {
originalTarget.apply(originalTarget, [name, args]);
isAdminAnalyticsEnabled =
!_.isUndefined(window.digitalData) &&
!_.isUndefined(window._satellite);
if (!hasPageBuilderBeenUsed && name.indexOf('stage:fullScreenModeChangeAfter') !== -1 &&
args.fullScreen && isAdminAnalyticsEnabled
) {
hasPageBuilderBeenUsed = true;
window.digitalData.page.url = window.location.href;
window.digitalData.page.attributes = {
editedWithPageBuilder: 'true'
};
window._satellite.track('page');
}
event = EventBuilder.build(name, args);
if (isAdminAnalyticsEnabled && !_.isUndefined(window.digitalData.event) && !_.isUndefined(event)) {
delayedPush = setInterval(function (object) {
if (_.isArray(window.digitalData.event)) {
window.digitalData.event.push(object);
window._satellite.track('event');
clearInterval(delayedPush);
}
}, 500, event);
}
};
return target;
};
});
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);
namespace Magento\PageBuilderAnalytics\Model;
use Magento\Analytics\ReportXml\ConnectionFactory;
use Magento\Analytics\ReportXml\IteratorFactory;
use Magento\Analytics\ReportXml\Query;
use Magento\Analytics\ReportXml\QueryFactory;
use Magento\Framework\DB\Adapter\AdapterInterface;
use Magento\PageBuilder\Model\Config;
/**
* Provides content type usage data report
*/
class ContentTypeUsageReportProvider
{
/**
* @var Config
*/
private $config;
/**
* @var QueryFactory
*/
private $queryFactory;
/**
* @var IteratorFactory
*/
private $iteratorFactory;
/**
* @var ConnectionFactory
*/
private $connectionFactory;
/**
* @var int
*/
private $batchSize;
/**
* ContentTypeProvider constructor.
*
* @param Config $config
* @param QueryFactory $queryFactory
* @param IteratorFactory $iteratorFactory
* @param ConnectionFactory $connectionFactory
* @param int $batchSize
*/
public function __construct(
Config $config,
QueryFactory $queryFactory,
IteratorFactory $iteratorFactory,
ConnectionFactory $connectionFactory,
$batchSize = 5000
) {
$this->config = $config;
$this->queryFactory = $queryFactory;
$this->iteratorFactory = $iteratorFactory;
$this->connectionFactory = $connectionFactory;
$this->batchSize = $batchSize;
}
/**
* Create the report based on the supplied query
*
* @param string $name
*
* @return \IteratorIterator
* @throws \Zend_Db_Statement_Exception
*/
public function getReport($name) : \IteratorIterator
{
$query = $this->queryFactory->create($name);
// Prepare our type count data
$typeCounts = [];
$contentTypes = $this->config->getContentTypes();
foreach ($contentTypes as $type) {
$typeCounts[$type['name']] = 0;
}
$connection = $this->connectionFactory->getConnection($query->getConnectionName());
// Determine the total row count and then calculate the batch size
$rowCount = $this->getRowCount($connection, $query);
$batches = ceil($rowCount / $this->batchSize);
if ($batches > 0) {
for ($batch = 0; $batch <= $batches; $batch++) {
$batchQuery = $connection->query(
$query->getSelect()->limit($this->batchSize, $batch * $this->batchSize)
);
foreach ($batchQuery->fetchAll() as $row) {
foreach ($contentTypes as $type) {
// Count the amount of content types within the content
$rowContent = $row['content'] ?? '';
if (strlen($rowContent) > 0) {
$typeCounts[$type['name']] += substr_count(
$rowContent,
'data-content-type="' . $type['name'] . '"'
);
}
}
}
}
}
foreach ($contentTypes as $type) {
$reportData[] = [
'type' => $type['name'],
'count' => $typeCounts[$type['name']]
];
}
return $this->iteratorFactory->create(
new \ArrayIterator($reportData)
);
}
/**
* Determine the row count for the current entity
*
* @param AdapterInterface $connection
* @param Query $query
*
* @return string
*/
private function getRowCount(AdapterInterface $connection, Query $query) : string
{
$countSelect = clone $query->getSelect();
$countSelect->reset(\Magento\Framework\DB\Select::COLUMNS)
->columns(['row_count' => new \Zend_Db_Expr('COUNT(*)')]);
return $connection->fetchOne($countSelect);
}
}
# Magento_PageBuilderAnalytics module
The Magento_PageBuilderAnalytics module configures data definitions for a data collection related to the PageBuilder module entities to be used in [Advanced Reporting](https://devdocs.magento.com/guides/v2.4/advanced-reporting/modules.html).
{
"name": "magento/module-page-builder-analytics",
"description": "Page Builder Analytics module",
"type": "magento2-module",
"license": [
"proprietary"
],
"version": "1.6.2",
"require": {
"magento/module-analytics": "100.4.*",
"magento/module-page-builder": "2.2.*",
"magento/framework": "103.0.*",
"php": "~7.4.0||~8.1.0"
},
"autoload": {
"files": [
"registration.php"
],
"psr-4": {
"Magento\\PageBuilderAnalytics\\": ""
}
}
}
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="Magento\Analytics\Model\StoreConfigurationProvider">
<arguments>
<argument name="configPaths" xsi:type="array">
<item name="1000" xsi:type="string">cms/pagebuilder/enabled</item>
<item name="1001" xsi:type="string">cms/pagebuilder/google_maps_api_key</item>
<item name="1002" xsi:type="string">cms/pagebuilder/column_grid_default</item>
<item name="1003" xsi:type="string">cms/pagebuilder/column_grid_max</item>
</argument>
</arguments>
</type>
</config>
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Magento_PageBuilderAnalytics">
<sequence>
<module name="Magento_PageBuilder"/>
<module name="Magento_Analytics"/>
</sequence>
</module>
</config>
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);
use \Magento\Framework\Component\ComponentRegistrar;
ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_PageBuilderAnalytics', __DIR__);
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\PageBuilder\Api\Data;
use Magento\Framework\Api\ExtensionAttributesInterface;
/**
* Extension interface for templates
*/
interface TemplateExtensionInterface extends ExtensionAttributesInterface
{
}
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\PageBuilder\Api\Data;
use Magento\Framework\Api\ExtensibleDataInterface;
/**
* Template Manager template interface
*/
interface TemplateInterface extends ExtensibleDataInterface
{
const KEY_ID = 'template_id';
const KEY_NAME = 'name';
const KEY_PREVIEW_IMAGE = 'preview_image';
const KEY_TEMPLATE = 'template';
const KEY_CREATED_FOR = 'created_for';
const KEY_CREATED_AT = 'created_at';
const KEY_UPDATED_AT = 'updated_at';
/**
* Get Template ID
*
* @return int|null
*/
public function getId();
/**
* Set the templates ID
*
* @param int $templateId
* @return TemplateInterface
*/
public function setId($templateId);
/**
* Retrieve name of template
*
* @return string|null
*/
public function getName() : string;
/**
* Set the name of the template
*
* @param string $name
* @return TemplateInterface
*/
public function setName(string $name) : TemplateInterface;
/**
* Retrieve the preview image
*
* @return string
*/
public function getPreviewImage() : string;
/**
* Set the preview image
*
* @param string $path
* @return TemplateInterface
*/
public function setPreviewImage(string $path) : TemplateInterface;
/**
* Get the thumbnail image for the preview
*
* @return string
*/
public function getPreviewThumbnailImage() : string;
/**
* Retrieve template value
*
* @return string
*/
public function getTemplate() : string;
/**
* Set template value
*
* @param string $template
* @return TemplateInterface
*/
public function setTemplate(string $template) : TemplateInterface;
/**
* Retrieve created for value, created for is a user provided field with entity names as values such as Page
*
* @return string
*/
public function getCreatedFor() : string;
/**
* Set the created for value
*
* @param string $createdFor
* @return TemplateInterface
*/
public function setCreatedFor(string $createdFor) : TemplateInterface;
/**
* Retrieve the updated at date
*
* @return mixed
*/
public function getUpdatedAt() : string;
/**
* Set updated at date
*
* @param string $updatedAt
* @return TemplateInterface
*/
public function setUpdatedAt(string $updatedAt) : TemplateInterface;
/**
* Get the created at date
*
* @return string
*/
public function getCreatedAt() : string;
/**
* Set the created at date
*
* @param string $createdAt
* @return TemplateInterface
*/
public function setCreatedAt(string $createdAt) : TemplateInterface;
/**
* Retrieve existing extension attributes object or create a new one
*
* @return \Magento\PageBuilder\Api\Data\TemplateExtensionInterface|null
*/
public function getExtensionAttributes();
/**
* Set an extension attributes object
*
* @param \Magento\PageBuilder\Api\Data\TemplateExtensionInterface $extensionAttributes
* @return $this
*/
public function setExtensionAttributes(
\Magento\PageBuilder\Api\Data\TemplateExtensionInterface $extensionAttributes
);
}
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\PageBuilder\Api\Data;
use Magento\Framework\Api\SearchResultsInterface;
interface TemplateSearchResultsInterface extends SearchResultsInterface
{
/**
* Get template list
*
* @return TemplateInterface[]
*/
public function getItems();
/**
* Set template list
*
* @param TemplateInterface[] $items
* @return $this
*/
public function setItems(array $items);
}
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\PageBuilder\Api;
use Magento\Framework\Api\SearchCriteriaInterface;
use Magento\PageBuilder\Api\Data\TemplateInterface;
use Magento\PageBuilder\Api\Data\TemplateSearchResultsInterface;
use Magento\Framework\Exception\LocalizedException;
use Magento\Framework\Exception\NoSuchEntityException;
interface TemplateRepositoryInterface
{
/**
* Save Template
*
* @param TemplateInterface $template
* @return TemplateInterface
* @throws LocalizedException
*/
public function save(TemplateInterface $template) : TemplateInterface;
/**
* Retrieve Template
*
* @param string $templateId
* @return TemplateInterface
* @throws LocalizedException
*/
public function get($templateId) : TemplateInterface;
/**
* Retrieve Template matching the specified criteria.
*
* @param SearchCriteriaInterface $searchCriteria
* @return TemplateSearchResultsInterface
* @throws LocalizedException
*/
public function getList(SearchCriteriaInterface $searchCriteria);
/**
* Delete Template
*
* @param TemplateInterface $template
* @return bool true on success
* @throws LocalizedException
*/
public function delete(TemplateInterface $template) : bool;
/**
* Delete Template by ID
*
* @param string $templateId
* @return bool true on success
* @throws NoSuchEntityException
* @throws LocalizedException
*/
public function deleteById($templateId) : bool;
}
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);
namespace Magento\PageBuilder\Block\Adminhtml\ContentType\Edit;
use Magento\Framework\View\Element\UiComponent\Control\ButtonProviderInterface;
/**
* Cancel button on edit panel for Content Type
*
* @api
*/
class CancelButton implements ButtonProviderInterface
{
/**
* @var string
*/
private $targetName;
/**
* Constructor
*
* @param $targetName
*/
public function __construct(string $targetName)
{
$this->targetName = $targetName;
}
/**
* Retrieve button data
*
* @return array
*/
public function getButtonData(): array
{
return [
'label' => __('Cancel'),
'class' => 'cancel',
'on_click' => '',
'data_attribute' => [
'mage-init' => [
'buttonAdapter' => [
'actions' => [
[
'targetName' => $this->targetName,
'actionName' => 'closeModal',
'params' => [
false,
]
]
]
]
],
'form-role' => 'cancel',
],
'sort_order' => 90
];
}
}
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);
namespace Magento\PageBuilder\Block\Adminhtml\ContentType\Edit;
use Magento\Framework\View\Element\UiComponent\Control\ButtonProviderInterface;
/**
* Close button on edit panel for Content Type
*
* @api
*/
class CloseButton implements ButtonProviderInterface
{
/**
* @var string
*/
private $targetName;
/**
* Constructor
*
* @param $targetName
*/
public function __construct(string $targetName)
{
$this->targetName = $targetName;
}
/**
* Retrieve button data
*
* @return array
*/
public function getButtonData() : array
{
return [
'label' => __('Close'),
'class' => 'close',
'on_click' => '',
'data_attribute' => [
'mage-init' => [
'buttonAdapter' => [
'actions' => [
[
'targetName' => $this->targetName,
'actionName' => 'closeModal',
'params' => [
false,
]
]
]
]
],
'form-role' => 'close',
],
'sort_order' => 90
];
}
}
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);
namespace Magento\PageBuilder\Block\Adminhtml\ContentType\Edit;
use Magento\Framework\View\Element\UiComponent\Control\ButtonProviderInterface;
/**
* Save button on edit panel for Content Type
*
* @api
*/
class SaveButton implements ButtonProviderInterface
{
/**
* Retrieve button data
*
* @return array
*/
public function getButtonData() : array
{
return [
'label' => __('Save'),
'class' => 'save primary',
'data_attribute' => [
'mage-init' => ['button' => ['event' => 'save']],
'form-role' => 'save',
],
'sort_order' => 30,
];
}
}
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);
namespace Magento\PageBuilder\Block\Adminhtml\Form\Element;
use Magento\Backend\Block\Template;
/**
* The block used to render the conditions rule tree form within the PageBuilder interface.
*
* @api
*/
class ProductConditions extends Template
{
/**
*
* @var string
*/
protected $_template = 'Magento_PageBuilder::form/element/conditions.phtml';
/**
* @var \Magento\Framework\Serialize\Serializer\Json
*/
private $serializer;
/**
* Conditions constructor.
* @param Template\Context $context
* @param \Magento\Framework\Serialize\Serializer\Json $serializer
* @param array $data
*/
public function __construct(
\Magento\Backend\Block\Template\Context $context,
\Magento\Framework\Serialize\Serializer\Json $serializer,
array $data = []
) {
$this->serializer = $serializer;
parent::__construct($context, $data);
}
/**
* Returns an array of arguments to pass to the condition tree UIComponent
*
* @return array
*/
private function getConfig(): array
{
$formNamespace = $this->getData('formNamespace');
$attribute = $this->getData('attribute');
$jsObjectName = $formNamespace . '_' . $attribute;
return [
'formNamespace' => $formNamespace,
'componentUrl' => $this->getUrl(
'pagebuilder/form/element_productconditions',
[
'form_namespace' => $formNamespace,
'prefix' => $attribute,
'js_object_name' => $jsObjectName,
]
),
'jsObjectName' => $jsObjectName,
'childComponentUrl' => $this->getUrl(
'pagebuilder/form/element_productconditions_child',
[
'form_namespace' => $formNamespace,
'prefix' => $attribute,
'js_object_name' => $jsObjectName,
]
),
'attribute' => $attribute,
];
}
/**
* Creates a JSON string containing the configuration for the needed JS components in the mage-init format
*
* @return string
*/
public function getConfigJson(): string
{
return $this->serializer->serialize([
'[data-role=pagebuilder-conditions-form-placeholder-' . $this->getData('attribute') . ']' => [
'Magento_PageBuilder/js/form/element/conditions-loader' => $this->getConfig(),
]
]);
}
}
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);
namespace Magento\PageBuilder\Block\Adminhtml\Html\Head;
use Magento\Framework\View\Element\Template;
/**
* Babel polyfill is required for IE 11 compatibility
*
* @api
*/
class BabelPolyfill extends Template
{
/**
* @var \Magento\PageBuilder\Model\ConfigInterface
*/
private $config;
/**
* @var \Magento\Framework\HTTP\Header
*/
private $httpHeader;
/**
* @param Template\Context $context
* @param \Magento\PageBuilder\Model\ConfigInterface $config
* @param \Magento\Framework\HTTP\Header $httpHeader
* @param array $data
*/
public function __construct(
Template\Context $context,
\Magento\PageBuilder\Model\ConfigInterface $config,
\Magento\Framework\HTTP\Header $httpHeader,
array $data = []
) {
$this->config = $config;
$this->httpHeader = $httpHeader;
parent::__construct($context, $data);
}
/**
* Detect if Page Builder is enabled and the user is loading the website from IE 11
*
* @return bool
*/
public function shouldLoadPolyfill() : bool
{
return $this->config->isEnabled() && $this->isIe11();
}
/**
* Build and return the polyfill static URL
*
* @return string
*/
public function getJsUrl() : string
{
return $this->_assetRepo->getUrl("Magento_PageBuilder::js/resource/babel/polyfill.min.js");
}
/**
* Extend the cache keys with a IE 11 flag
*
* @return array
*/
public function getCacheKeyInfo() : array
{
$cacheKeys = parent::getCacheKeyInfo();
$cacheKeys['is_ie11'] = $this->isIe11();
return $cacheKeys;
}
/**
* Detect if the browser user agent contains the IE 11 user agent
*
* @return bool
*/
private function isIe11() : bool
{
return strpos($this->httpHeader->getHttpUserAgent(), 'rv:11.0') !== false
&& strpos($this->httpHeader->getHttpUserAgent(), 'Trident/7.0;') !== false;
}
}
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);
namespace Magento\PageBuilder\Block\Adminhtml\Stage;
use Magento\Framework\App\ObjectManager;
use Magento\Framework\View\Asset\Minification;
use Magento\Framework\View\Element\Template;
use Magento\RequireJs\Model\FileManager;
use Magento\PageBuilder\Model\Stage\Config;
use Magento\Framework\Serialize\Serializer\Json;
/**
* Class Render
*
* @api
*/
class Render extends Template
{
/**
* @var FileManager
*/
private $fileManager;
/**
* @var Config
*/
private $pageBuilderConfig;
/**
* @var Json
*/
private $json;
/**
* @var Minification
*/
private $minification;
/**
* @param Template\Context $context
* @param FileManager $fileManager
* @param Config $config
* @param Json $json
* @param array $data
* @param Minification $minification
*/
public function __construct(
Template\Context $context,
FileManager $fileManager,
Config $config,
Json $json,
array $data = [],
Minification $minification = null
) {
parent::__construct($context, $data);
$this->fileManager = $fileManager;
$this->pageBuilderConfig = $config;
$this->json = $json;
$this->minification = $minification ?: ObjectManager::getInstance()->get(Minification::class);
}
/**
* Generate the URL to RequireJS
*
* @return string
* @throws \Magento\Framework\Exception\LocalizedException
*/
public function getRequireJsUrl() : string
{
$asset = $this->_assetRepo->createAsset('requirejs/require.js');
return $asset->getUrl();
}
/**
* Generate the URL to the RequireJS min resolver, if minification enabled.
*
* @return string|null
*/
public function getRequireJsMinUrl() : ?string
{
if ($this->minification->isEnabled('js')) {
$minResolverAsset = $this->fileManager->createMinResolverAsset();
return $minResolverAsset->getUrl();
}
return null;
}
/**
* Retrieve the URL to the RequireJS Config file
*
* @return string
*/
public function getRequireJsConfigUrl() : string
{
$requireJsConfig = $this->fileManager->createRequireJsConfigAsset();
return $requireJsConfig->getUrl();
}
/**
* Retrieve the Page Builder's config
*
* @return array
*/
public function getPageBuilderConfig() : string
{
return $this->json->serialize($this->pageBuilderConfig->getConfig());
}
}
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);
namespace Magento\PageBuilder\Block\Adminhtml\System\Config;
use Magento\Framework\Data\Form\Element\AbstractElement;
/**
* Class EnableField renders modal window if disable PB in System Configuration
*
* @api
*/
class EnableField extends \Magento\Config\Block\System\Config\Form\Field
{
/**
* @var \Magento\Framework\Serialize\Serializer\Json
*/
private $json;
/**
* @param \Magento\Backend\Block\Template\Context $context
* @param \Magento\Framework\Serialize\Serializer\Json $json
* @param array $data
*/
public function __construct(
\Magento\Backend\Block\Template\Context $context,
\Magento\Framework\Serialize\Serializer\Json $json,
array $data = []
) {
parent::__construct($context, $data);
$this->json = $json;
}
/**
* {@inheritdoc}
*/
protected function _getElementHtml(AbstractElement $element)
{
$html = parent::_getElementHtml($element);
$enablePageBuilderSelector = '#cms_pagebuilder_enabled';
$jsString = '<script type="text/x-magento-init"> {"' .
$enablePageBuilderSelector . '": {
"Magento_PageBuilder/js/system/config/enable-field": {"modalTitleText": ' .
$this->json->serialize($this->getModalTitleText()) . ', "modalContentBody": ' .
$this->json->serialize($this->getModalContentBody())
. '}}}</script>';
$html .= $jsString;
return $html;
}
/**
* Get text for the modal title heading when user switches to disable
*
* @return \Magento\Framework\Phrase
*/
private function getModalTitleText() : \Magento\Framework\Phrase
{
return __('Are You Sure You Want to Turn Off Page Builder?');
}
/**
* Get HTML for the modal content body when user switches to disable
*
* @return string
*/
private function getModalContentBody()
{
$templateFileName = $this->getTemplateFile(
'Magento_PageBuilder::system/config/enable_field/modal_content_body.phtml'
);
return $this->fetchView($templateFileName);
}
}
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);
namespace Magento\PageBuilder\Block\Adminhtml\System\Config\Form\Field;
/**
* @api
*/
class GoogleMapsApiKey extends \Magento\Config\Block\System\Config\Form\Field
{
/**
* @inheritdoc
*/
protected function _prepareLayout()
{
parent::_prepareLayout();
$this->setTemplate('Magento_PageBuilder::system/config/google_maps_api_key.phtml');
return $this;
}
/**
* @inheritdoc
*/
public function render(\Magento\Framework\Data\Form\Element\AbstractElement $element)
{
$element = clone $element;
$element->unsScope()->unsCanUseWebsiteValue()->unsCanUseDefaultValue();
return parent::render($element);
}
/**
* @inheritdoc
*/
protected function _getElementHtml(\Magento\Framework\Data\Form\Element\AbstractElement $element)
{
$originalData = $element->getOriginalData();
$this->addData(
[
'button_label' => __($originalData['button_label']),
'valid_label' => __($originalData['valid_label']),
'invalid_label' => __($originalData['invalid_label']),
'source_field' => $originalData['source_field'],
'html_id' => $element->getHtmlId(),
'validate_url' => $this->_urlBuilder->getUrl('pagebuilder/googlemaps/validateapi')
]
);
return $this->_toHtml();
}
}
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);
namespace Magento\PageBuilder\Block\Adminhtml\System\Config;
/**
* Class SwitchAttributeType renders modal window to confirm changing attribute type
*
*/
class SwitchAttributeType extends \Magento\Config\Block\System\Config\Form\Field
{
/**
* @param \Magento\Backend\Block\Template\Context $context
* @param array $data
*/
public function __construct(
\Magento\Backend\Block\Template\Context $context,
array $data = []
) {
parent::__construct($context, $data);
}
/**
* Get text for the modal title heading when user switches to disable
*
* @return string
*/
public function getModalSelector() : string
{
return '#frontend_input';
}
/**
* Get text for the modal title heading when user switches to disable
*
* @return \Magento\Framework\Phrase
*/
public function getModalTitleText() : \Magento\Framework\Phrase
{
return __('Product data may be lost');
}
/**
* Get HTML for the modal content body when user switches to disable
*
* @return string
*/
public function getModalContentBody() :string
{
$content = __("Changing the Input Type may result in product data loss. Proceed with caution.");
return '<div class="pagebuilder-modal-content-body">' . $content . '</div>';
}
}
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);
namespace Magento\PageBuilder\Block\Catalog\Block\Product\View;
use Magento\Framework\DataObject;
/**
* Create a new instance of attributes which excludes Page Builder attributes
*/
class Attributes extends \Magento\Catalog\Block\Product\View\Attributes
{
const DISPLAY_ATTRIBUTES_NON_PAGEBUILDER = 'non_pagebuilder';
const DISPLAY_ATTRIBUTES_PAGEBUILDER_ONLY = 'pagebuilder_only';
/**
* @inheritdoc
*/
public function getProduct()
{
$product = parent::getProduct();
if (!$product) {
$product = new DataObject();
$product->setAttributes([]);
}
return $product;
}
/**
* Determine if we should display the attribute on the front-end, add support for exclude page builder & page
* builder only options on class. display_attributes can be set to determine whether to include just Page Builder
* attributes or to exclude them.
*
* @param \Magento\Eav\Model\Entity\Attribute\AbstractAttribute $attribute
* @param array $excludeAttr
* @return bool
* @throws \Magento\Framework\Exception\LocalizedException
*/
protected function isVisibleOnFrontend(
\Magento\Eav\Model\Entity\Attribute\AbstractAttribute $attribute,
array $excludeAttr
) : bool {
return parent::isVisibleOnFrontend($attribute, $excludeAttr)
&& (($this->getDisplayAttributes() == self::DISPLAY_ATTRIBUTES_NON_PAGEBUILDER
&& !$attribute->getIsPagebuilderEnabled())
|| ($this->getDisplayAttributes() == self::DISPLAY_ATTRIBUTES_PAGEBUILDER_ONLY
&& $attribute->getIsPagebuilderEnabled()));
}
}
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);
namespace Magento\PageBuilder\Block\Element;
/**
* Class Editor add logic to render PB instead of wysiwyg editor
*
* @api
*/
class Editor extends \Magento\Framework\Data\Form\Element\Editor
{
/**
* {@inheritdoc}
*/
public function getElementHtml()
{
if ($this->isPageBuilderUsed()) {
return '';
}
return parent::getElementHtml();
}
/**
* {@inheritdoc}
*/
public function isEnabled()
{
if ($this->isPageBuilderUsed()) {
return true;
}
return parent::isEnabled();
}
/**
* Is the stage aspect of the system enabled
*
* @return bool
*/
protected function isStageEnabled() : bool
{
return true;
}
/**
* {@inheritdoc}
*/
protected function getInlineJs($jsSetupObject, $forceLoad)
{
if ($this->isPageBuilderUsed()) {
return '';
}
return parent::getInlineJs($jsSetupObject, $forceLoad);
}
/**
* Return if page builder will be used instead of wysiwyg editor
*
* @return bool
*/
private function isPageBuilderUsed() : bool
{
$config = $this->getConfig();
return $config->getData('activeEditorPath') === 'Magento_PageBuilder/pageBuilderAdapter'
&& $config->getData('is_pagebuilder_enabled') !== false;
}
}
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);
namespace Magento\PageBuilder\Block;
use Magento\Framework\View\Element\Template;
/**
* Google Maps API Block
*
* @api
*/
class GoogleMapsApi extends \Magento\Framework\View\Element\Template
{
const GOOGLE_MAPS_API_KEY_PATH = 'cms/pagebuilder/google_maps_api_key';
const GOOGLE_MAPS_LIBRARY_URL = 'https://maps.googleapis.com/maps/api/js?v=3&key=%s';
const GOOGLE_MAPS_STYLE_PATH = 'cms/pagebuilder/google_maps_style';
/**
* Retrieve the Google Maps API key
*
* @return string
*/
public function getApiKey(): ?string
{
return $this->_scopeConfig->getValue(self::GOOGLE_MAPS_API_KEY_PATH);
}
/**
* Generate URL for retrieving Google Maps Javascript API
*
* @return string
*/
public function getLibraryUrl(): string
{
return sprintf(self::GOOGLE_MAPS_LIBRARY_URL, $this->getApiKey());
}
/**
* Retrieve Google Maps Styles from Configurations
*
* @return string|null
*/
public function getStyle(): ?string
{
return $this->_scopeConfig->getValue(self::GOOGLE_MAPS_STYLE_PATH);
}
/**
* Return the translated message for an invalid API key.
*
* @return \Magento\Framework\Phrase
*/
public function getInvalidApiKeyMessage(): \Magento\Framework\Phrase
{
return __(
"You must provide a valid <a href='%1' target='_blank'>Google Maps API key</a> to use a map.",
$this->_urlBuilder->getUrl('adminhtml/system_config/edit/section/cms', ['_fragment' => 'cms_pagebuilder'])
);
}
/**
* Include the Google Maps library within the admin only if the API key is set
*
* @return bool
*/
public function shouldIncludeGoogleMapsLibrary(): bool
{
try {
return $this->_appState->getAreaCode() !== \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE ||
$this->getApiKey();
} catch (\Magento\Framework\Exception\LocalizedException $e) {
return false;
}
}
}
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);
namespace Magento\PageBuilder\Block;
use Magento\Framework\View\Element\Template;
/**
* Class WidgetInitializer provides configuration for content types widgets need to be loaded on frontend
*
* @api
*/
class WidgetInitializer extends Template
{
/**
* @var \Magento\Framework\Serialize\Serializer\Json
*/
private $jsonSerializer;
/**
* @var \Magento\PageBuilder\Model\WidgetInitializerConfig
*/
private $config;
/**
* WidgetInitializer constructor.
* @param Template\Context $context
* @param \Magento\Framework\Serialize\Serializer\Json $jsonEncoder
* @param \Magento\PageBuilder\Model\WidgetInitializerConfig $config
* @param array $data
*/
public function __construct(
\Magento\Framework\View\Element\Template\Context $context,
\Magento\Framework\Serialize\Serializer\Json $jsonEncoder,
\Magento\PageBuilder\Model\WidgetInitializerConfig $config,
array $data = []
) {
$this->jsonSerializer = $jsonEncoder;
$this->config = $config;
parent::__construct($context, $data);
}
/**
* Returns config for widgets initializer component.
*
* @return string
* @api
*/
public function getConfig() : string
{
return $this->jsonSerializer->serialize($this->config->getConfig());
}
/**
* Returns breakpoints for widgets initializer component.
*
* @return string
*/
public function getBreakpoints() : string
{
return $this->jsonSerializer->serialize($this->config->getBreakpoints());
}
}
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);
namespace Magento\PageBuilder\Block;
use Magento\Framework\App\ObjectManager;
use Magento\Framework\Cache\FrontendInterface;
use Magento\Framework\DataObject;
use Magento\Framework\View\Element\Template;
use Magento\Framework\View\Element\Template\Context;
use Magento\PageBuilder\Model\Session\RandomKey;
use Magento\Ui\Component\Wysiwyg\ConfigInterface;
/**
* @api
*/
class WysiwygSetup extends Template
{
private const WYSIWYG_CONFIG_CACHE_ID = 'WYSIWYG_CONFIG';
/**
* @var ConfigInterface
*/
private $config;
/**
* @var FrontendInterface
*/
private $cache;
/**
* @var RandomKey
*/
private $sessionRandomKey;
/**
* @param Context $context
* @param ConfigInterface $config
* @param array $data
* @param FrontendInterface|null $cache
* @param RandomKey|null $sessionRandomKey
*/
public function __construct(
Context $context,
ConfigInterface $config,
array $data = [],
FrontendInterface $cache = null,
?RandomKey $sessionRandomKey = null
) {
$this->config = $config;
$this->cache = $cache ?: ObjectManager::getInstance()->get(FrontendInterface::class);
$this->sessionRandomKey = $sessionRandomKey
?: ObjectManager::getInstance()->get(RandomKey::class);
parent::__construct($context, $data);
}
/**
* Get config for wysiwyg initialization
*
* @return string
*/
public function getConfigJson() : string
{
$cacheKey = self::WYSIWYG_CONFIG_CACHE_ID;
if ($this->_urlBuilder->useSecretKey()) {
$cacheKey .= '_' . $this->sessionRandomKey->getValue();
}
$configJson = $this->cache->load($cacheKey);
if (!$configJson) {
$config = $this->config->getConfig();
if (is_array($config)) {
$config = new DataObject($config);
}
$configJson = $config->toJson();
$this->cache->save($configJson, $cacheKey);
}
return $configJson;
}
}
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);
namespace Magento\PageBuilder\Component\Form\Element;
use Magento\Framework\App\ObjectManager;
use Magento\Framework\Data\FormFactory;
use Magento\Framework\View\Asset\Repository;
use Magento\Framework\View\Element\UiComponent\ContextInterface;
use Magento\Ui\Component\Wysiwyg\ConfigInterface;
use Magento\Catalog\Api\CategoryAttributeRepositoryInterface;
use Magento\Framework\Exception\NoSuchEntityException;
use Magento\PageBuilder\Model\Config as PageBuilderConfig;
use Magento\PageBuilder\Model\State as PageBuilderState;
use Magento\PageBuilder\Model\Stage\Config as Config;
use Magento\Framework\View\ConfigInterface as ViewConfigInterface;
/**
* Updates wysiwyg element with Page Builder specific config
*
* @api
*/
class Wysiwyg extends \Magento\Ui\Component\Form\Element\Wysiwyg
{
/**
* @var Repository
*/
private $assetRepo;
/**
* WYSIWYG Constructor
*
* @param ContextInterface $context
* @param FormFactory $formFactory
* @param ConfigInterface $wysiwygConfig
* @param CategoryAttributeRepositoryInterface $attrRepository
* @param PageBuilderState $pageBuilderState
* @param Config $stageConfig
* @param array $components
* @param array $data
* @param array $config
* @param PageBuilderConfig|null $pageBuilderConfig
* @param bool $overrideSnapshot
* @param Repository $assetRepo
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
* @SuppressWarnings(PHPMD.NPathComplexity)
* @throws \Magento\Framework\Exception\NoSuchEntityException
*/
public function __construct(
ContextInterface $context,
FormFactory $formFactory,
ConfigInterface $wysiwygConfig,
CategoryAttributeRepositoryInterface $attrRepository,
PageBuilderState $pageBuilderState,
Config $stageConfig,
array $components = [],
array $data = [],
array $config = [],
PageBuilderConfig $pageBuilderConfig = null,
bool $overrideSnapshot = false,
Repository $assetRepo = null
) {
$this->assetRepo = $assetRepo ?: ObjectManager::getInstance()->get(Repository::class);
$wysiwygConfigData = isset($config['wysiwygConfigData']) ? $config['wysiwygConfigData'] : [];
// If a dataType is present we're dealing with an attribute
if (isset($config['dataType'])) {
try {
$attribute = $attrRepository->get($data['name']);
if ($attribute) {
$config['wysiwyg'] = (bool)$attribute->getIsWysiwygEnabled();
}
} catch (NoSuchEntityException $e) {
$config['wysiwyg'] = true;
}
}
$isEnablePageBuilder = isset($wysiwygConfigData['is_pagebuilder_enabled'])
&& !$wysiwygConfigData['is_pagebuilder_enabled']
|| false;
if (!$pageBuilderState->isPageBuilderInUse($isEnablePageBuilder)) {
// This is not done using definition.xml due to https://github.com/magento/magento2/issues/5647
$data['config']['component'] = 'Magento_PageBuilder/js/form/element/wysiwyg';
// Override the templates to include our KnockoutJS code
$data['config']['template'] = 'ui/form/field';
$data['config']['elementTmpl'] = 'Magento_PageBuilder/form/element/wysiwyg';
$wysiwygConfigData = $stageConfig->getConfig();
$wysiwygConfigData['pagebuilder_button'] = true;
$wysiwygConfigData['pagebuilder_content_snapshot'] = true;
$wysiwygConfigData = $this->processBreakpointsIcons($wysiwygConfigData);
if ($overrideSnapshot) {
$pageBuilderConfig = $pageBuilderConfig ?: ObjectManager::getInstance()->get(PageBuilderConfig::class);
$wysiwygConfigData['pagebuilder_content_snapshot'] = $pageBuilderConfig->isContentPreviewEnabled();
}
// Add Classes for Page Builder Stage
if (isset($wysiwygConfigData['pagebuilder_content_snapshot'])
&& $wysiwygConfigData['pagebuilder_content_snapshot']) {
$data['config']['additionalClasses'] = [
'admin__field-wide admin__field-page-builder' => true
];
}
$data['config']['wysiwygConfigData'] = isset($config['wysiwygConfigData']) ?
array_replace_recursive($config['wysiwygConfigData'], $wysiwygConfigData) :
$wysiwygConfigData;
$wysiwygConfigData['activeEditorPath'] = 'Magento_PageBuilder/pageBuilderAdapter';
$config['wysiwygConfigData'] = $wysiwygConfigData;
}
parent::__construct($context, $formFactory, $wysiwygConfig, $components, $data, $config);
}
/**
* Process viewport icon paths
*
* @param array $wysiwygConfigData
* @return array
*/
private function processBreakpointsIcons(array $wysiwygConfigData): array
{
if ($wysiwygConfigData && isset($wysiwygConfigData['viewports'])) {
foreach ($wysiwygConfigData['viewports'] as $breakpoint => $attributes) {
if (isset($attributes['icon'])) {
$wysiwygConfigData['viewports'][$breakpoint]['icon'] = $this->assetRepo->getUrl(
$attributes['icon']
);
}
}
}
return $wysiwygConfigData;
}
}
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\PageBuilder\Component\Form;
use Magento\Backend\Model\UrlInterface as BackendUrlInterface;
use Magento\Cms\Helper\Wysiwyg\Images;
use Magento\Framework\App\ObjectManager;
use Magento\Framework\View\Element\UiComponentFactory;
use Magento\Framework\View\Element\UiComponent\ContextInterface;
use Magento\Ui\Component\Form\Element\DataType\Media\OpenDialogUrl;
use Magento\Variable\Model\Variable\Config as VariableConfig;
/**
* Updates field element with HTML Code specific config
*/
class HtmlCode extends \Magento\Ui\Component\Form\Field
{
const HTML_ID_PLACEHOLDER = 'HTML_ID_PLACEHOLDER';
/**
* @var BackendUrlInterface
*/
private $backendUrl;
/**
* @var Images
*/
private $imagesHelper;
/**
* @var VariableConfig
*/
private $variableConfig;
/**
* @var string
*/
private $currentTreePath;
/**
* @var OpenDialogUrl
*/
private $openDialogUrl;
/**
* @param ContextInterface $context
* @param UiComponentFactory $uiComponentFactory
* @param BackendUrlInterface $backendUrl
* @param Images $imagesHelper
* @param VariableConfig $variableConfig
* @param OpenDialogUrl|null $openDialogUrl
* @param string $currentTreePath
* @param array $components
* @param array $data
*/
public function __construct(
ContextInterface $context,
UiComponentFactory $uiComponentFactory,
BackendUrlInterface $backendUrl,
Images $imagesHelper,
VariableConfig $variableConfig,
OpenDialogUrl $openDialogUrl = null,
$currentTreePath = 'wysiwyg',
$components = [],
array $data = []
) {
$this->backendUrl = $backendUrl;
$this->imagesHelper = $imagesHelper;
$this->variableConfig = $variableConfig;
$this->currentTreePath = $currentTreePath;
$this->openDialogUrl = $openDialogUrl ?: ObjectManager::getInstance()->get(OpenDialogUrl::class);
parent::__construct($context, $uiComponentFactory, $components, $data);
}
/**
* Prepare component configuration
*
* @return void
* @throws \Magento\Framework\Exception\LocalizedException
*/
public function prepare()
{
$config = $this->getData('config');
$config['widgetUrl'] = $this->backendUrl->getUrl(
'adminhtml/widget/index',
[
'widget_target_id' => self::HTML_ID_PLACEHOLDER
]
);
$config['imageUrl'] = $this->backendUrl->getUrl(
$this->openDialogUrl->get(),
[
'current_tree_path' => $this->imagesHelper->idEncode($this->currentTreePath),
'target_element_id' => self::HTML_ID_PLACEHOLDER
]
);
$config['variableUrl'] = $this->variableConfig->getVariablesWysiwygActionUrl();
$this->setData('config', $config);
parent::prepare();
}
}
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);
namespace Magento\PageBuilder\Component;
use Magento\Framework\App\Config\ScopeConfigInterface;
use Magento\Framework\UrlInterface;
use Magento\Framework\View\Element\UiComponent\ContextInterface;
use Magento\PageBuilder\Model\GoogleMaps\ApiKeyValidator;
/**
* Google Maps API Key Validation Container for UI Component Form
*
* @api
*/
class GoogleMapsApiKeyValidationContainer extends \Magento\Ui\Component\Container
{
const GOOGLE_MAPS_API_KEY_PATH = 'cms/pagebuilder/google_maps_api_key';
/**
* @var UrlInterface
*/
private $url;
/**
* @var ScopeConfigInterface
*/
private $scopeConfig;
/**
* Constructor
*
* @param ContextInterface $context
* @param UrlInterface $url
* @param ScopeConfigInterface $scopeConfig
* @param array $components
* @param array $data
*/
public function __construct(
ContextInterface $context,
UrlInterface $url,
ScopeConfigInterface $scopeConfig,
array $components = [],
array $data = []
) {
parent::__construct(
$context,
$components,
$data
);
$this->url = $url;
$this->scopeConfig = $scopeConfig;
}
/**
* Prepare component configuration
*
* @return void
*/
public function prepare()
{
parent::prepare();
$config = $this->getData('config');
$apiKey = $this->scopeConfig->getValue(self::GOOGLE_MAPS_API_KEY_PATH) ?: "";
if (trim($apiKey) == "") {
$config['visible'] = true;
}
if (isset($config['map_configuration_url'])) {
$config['map_configuration_url'] = $this->url->getUrl(
$config['map_configuration_url'],
['_fragment' => 'cms_pagebuilder']
);
}
if (isset($config['content'])) {
$config['content'] = sprintf($config['content'], $config['map_configuration_url']);
}
$this->setData('config', (array) $config);
}
}
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);
namespace Magento\PageBuilder\Controller\Adminhtml\ContentType\Block;
use Magento\Framework\Controller\ResultFactory;
class Metadata extends \Magento\Backend\App\AbstractAction
{
/**
* {@inheritdoc}
*/
const ADMIN_RESOURCE = 'Magento_Cms::block';
/**
* @var \Magento\Cms\Model\ResourceModel\Block\CollectionFactory
*/
private $blockCollectionFactory;
/**
* DataProvider constructor.
* @param \Magento\Backend\App\Action\Context $context
* @param \Magento\Cms\Model\ResourceModel\Block\CollectionFactory $blockCollectionFactory
*/
public function __construct(
\Magento\Backend\App\Action\Context $context,
\Magento\Cms\Model\ResourceModel\Block\CollectionFactory $blockCollectionFactory
) {
parent::__construct($context);
$this->blockCollectionFactory = $blockCollectionFactory;
}
public function execute()
{
$params = $this->getRequest()->getParams();
try {
$collection = $this->blockCollectionFactory->create();
$blocks = $collection
->addFieldToSelect(['title','is_active'])
->addFieldToFilter('block_id', ['eq' => $params['block_id']])
->load();
$result = $blocks->getFirstItem()->toArray();
} catch (\Exception $e) {
$result = [
'error' => $e->getMessage(),
'errorcode' => $e->getCode()
];
}
return $this->resultFactory->create(ResultFactory::TYPE_JSON)->setData($result);
}
}
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\PageBuilder\Controller\Adminhtml\ContentType\Image;
use Magento\Framework\App\Action\HttpPostActionInterface;
use Magento\Framework\App\Filesystem\DirectoryList;
use Magento\Framework\App\ObjectManager;
use Magento\Framework\Filesystem;
/**
* Image upload controller
*
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class Upload extends \Magento\Backend\App\Action implements HttpPostActionInterface
{
const UPLOAD_DIR = 'wysiwyg';
const ADMIN_RESOURCE = 'Magento_Backend::content';
/**
* @var \Magento\Framework\Filesystem\DirectoryList
* @deprecad use $mediaDirectory instead
*/
private $directoryList;
/**
* @var \Magento\Framework\Controller\Result\JsonFactory
*/
private $resultJsonFactory;
/**
* @var \Magento\Framework\File\UploaderFactory
*/
private $uploaderFactory;
/**
* @var \Magento\Store\Model\StoreManagerInterface
*/
private $storeManager;
/**
* @var \Magento\Cms\Helper\Wysiwyg\Images
*/
private $cmsWysiwygImages;
/**
* @var Filesystem\Directory\WriteInterface
*/
private $mediaDirectory;
/**
* Constructor
*
* @param \Magento\Backend\App\Action\Context $context
* @param \Magento\Framework\Controller\Result\JsonFactory $resultJsonFactory
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
* @param \Magento\Framework\File\UploaderFactory $uploaderFactory
* @param \Magento\Framework\Filesystem\DirectoryList $directoryList
* @param \Magento\Cms\Helper\Wysiwyg\Images $cmsWysiwygImages
* @param Filesystem|null $filesystem
* @throws \Magento\Framework\Exception\FileSystemException
*/
public function __construct(
\Magento\Backend\App\Action\Context $context,
\Magento\Framework\Controller\Result\JsonFactory $resultJsonFactory,
\Magento\Store\Model\StoreManagerInterface $storeManager,
\Magento\Framework\File\UploaderFactory $uploaderFactory,
\Magento\Framework\Filesystem\DirectoryList $directoryList,
\Magento\Cms\Helper\Wysiwyg\Images $cmsWysiwygImages,
Filesystem $filesystem = null
) {
parent::__construct($context);
$this->resultJsonFactory = $resultJsonFactory;
$this->storeManager = $storeManager;
$this->uploaderFactory = $uploaderFactory;
$this->directoryList = $directoryList;
$this->cmsWysiwygImages = $cmsWysiwygImages;
$filesystem = $filesystem ?? ObjectManager::getInstance()->create(Filesystem::class);
$this->mediaDirectory = $filesystem->getDirectoryWrite(DirectoryList::MEDIA);
}
/**
* Retrieve path
*
* @param string $path
* @param string $imageName
* @return string
*/
private function getFilePath($path, $imageName)
{
return rtrim($path, '/') . '/' . ltrim($imageName, '/');
}
/**
* Allow users to upload images to the folder structure
*
* @return \Magento\Framework\Controller\ResultInterface
*/
public function execute()
{
$fieldName = $this->getRequest()->getParam('param_name');
$fileUploader = $this->uploaderFactory->create(['fileId' => $fieldName]);
// Set our parameters
$fileUploader->setFilesDispersion(false);
$fileUploader->setAllowRenameFiles(true);
$fileUploader->setAllowedExtensions(['jpeg','jpg','png','gif']);
$fileUploader->setAllowCreateFolders(true);
try {
if (!$fileUploader->checkMimeType(['image/png', 'image/jpeg', 'image/gif'])) {
throw new \Magento\Framework\Exception\LocalizedException(__('File validation failed.'));
}
$result = $fileUploader->save($this->getUploadDir());
$baseUrl = $this->_backendUrl->getBaseUrl(['_type' => \Magento\Framework\UrlInterface::URL_TYPE_MEDIA]);
$result['id'] = $this->cmsWysiwygImages->idEncode($result['file']);
$result['url'] = $baseUrl . $this->getFilePath(self::UPLOAD_DIR, $result['file']);
} catch (\Exception $e) {
$result = [
'error' => $e->getMessage(),
'errorcode' => $e->getCode()
];
}
return $this->resultJsonFactory->create()->setData($result);
}
/**
* Return the upload directory
*
* @return string
*/
private function getUploadDir()
{
return $this->mediaDirectory->getAbsolutePath(self::UPLOAD_DIR);
}
}
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);
namespace Magento\PageBuilder\Controller\Adminhtml\Form\Element;
use Magento\Rule\Model\Condition\Combine;
/**
* Responsible for rendering the top-level conditions rule tree using the provided params
*/
class ProductConditions extends \Magento\CatalogWidget\Controller\Adminhtml\Product\Widget
{
/**
* @var \Magento\CatalogWidget\Model\Rule
*/
private $rule;
/**
* @var \Magento\Framework\Serialize\Serializer\Json
*/
private $serializer;
/**
* @param \Magento\Backend\App\Action\Context $context
* @param \Magento\CatalogWidget\Model\Rule $rule
* @param \Magento\Framework\Serialize\Serializer\Json $serializer
*/
public function __construct(
\Magento\Backend\App\Action\Context $context,
\Magento\CatalogWidget\Model\Rule $rule,
\Magento\Framework\Serialize\Serializer\Json $serializer
) {
$this->rule = $rule;
$this->serializer = $serializer;
parent::__construct($context);
}
/**
* @return void
*/
public function execute()
{
$prefix = $this->getRequest()->getParam('prefix', 'conditions');
$conditionsEncoded = $this->getRequest()->getParam('conditions');
$conditions = $this->rule->getConditions();
$conditions->setData('prefix', $prefix);
// The rule class expects something to be set in the prefix field before the conditions are loaded
$conditions->setData($prefix, []);
$this->rule->loadPost(['conditions' => $this->serializer->unserialize($conditionsEncoded)]);
$formName = $this->getRequest()->getParam('form_namespace');
// Combine class recursively sets jsFormObject so we don't need to
$conditions->setJsFormObject($this->getRequest()->getParam('js_object_name'));
// The Combine class doesn't need the data attribute on children but we do.
$this->configureConditionsFormName($conditions, $formName);
$result = $conditions->asHtmlRecursive();
$this->getResponse()->setBody($result);
}
/**
* Recursively set form name for data-form-part to be set on all conditions HTML
*
* @param Combine $conditions
* @param string $formName
* @return void
*/
private function configureConditionsFormName(Combine $conditions, string $formName): void
{
$conditions->setFormName($formName);
foreach ($conditions->getConditions() as $condition) {
if ($condition instanceof Combine) {
$this->configureConditionsFormName($condition, $formName);
} else {
$condition->setFormName($formName);
}
}
}
}
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);
namespace Magento\PageBuilder\Controller\Adminhtml\Form\Element\ProductConditions;
use Magento\Framework\App\Action\HttpPostActionInterface;
use Magento\Rule\Model\Condition\AbstractCondition;
/**
* Responsible for rendering the child elements of the conditions rule tree using the provided params
*/
class Child extends \Magento\CatalogWidget\Controller\Adminhtml\Product\Widget implements HttpPostActionInterface
{
/**
* @var \Magento\CatalogWidget\Model\Rule
*/
private $rule;
/**
* @param \Magento\Backend\App\Action\Context $context
* @param \Magento\CatalogWidget\Model\Rule $rule
*/
public function __construct(
\Magento\Backend\App\Action\Context $context,
\Magento\CatalogWidget\Model\Rule $rule
) {
$this->rule = $rule;
parent::__construct($context);
}
/**
* Render child template
*
* @return void
*/
public function execute()
{
$id = $this->getRequest()->getParam('id');
$formName = $this->getRequest()->getParam('form_namespace');
$jsObjectName = $this->getRequest()->getParam('js_object_name');
$typeData = explode('|', str_replace('-', '/', $this->getRequest()->getParam('type')));
$className = $typeData[0];
$prefix = $this->getRequest()->getParam('prefix', 'conditions');
$model = $this->_objectManager->create($className)
->setId($id)
->setType($className)
->setRule($this->rule)
->setPrefix($prefix);
if (!empty($typeData[1])) {
$model->setAttribute($typeData[1]);
}
$result = '';
if ($model instanceof AbstractCondition) {
// set value of $prefix in model's data registry to value of 'conditions',
// as is required for correct use of \Magento\Rule\Model\Condition\Combine::getConditions
if ($model->getData($prefix) === null) {
$model->setData($prefix, $model->getData('conditions'));
}
$model->setJsFormObject($jsObjectName);
$model->setFormName($formName);
$result = $model->asHtmlRecursive();
}
$this->getResponse()->setBody($result);
}
}
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);
namespace Magento\PageBuilder\Controller\Adminhtml\Form\Element;
use Exception;
use Magento\Backend\App\Action;
use Magento\Backend\App\Action\Context;
use Magento\Framework\App\Action\HttpPostActionInterface;
use Magento\Framework\Controller\Result\JsonFactory;
/**
* Returns the number of products that match the provided conditions
*/
class ProductTotals extends Action implements HttpPostActionInterface
{
const ADMIN_RESOURCE = 'Magento_Catalog::products';
/**
* @var \Magento\PageBuilder\Model\Catalog\ProductTotals
*/
private $productTotals;
/**
* @var JsonFactory
*/
private $jsonFactory;
/**
* @param Context $context
* @param \Magento\PageBuilder\Model\Catalog\ProductTotals $productTotals
* @param JsonFactory $jsonFactory
*/
public function __construct(
Context $context,
\Magento\PageBuilder\Model\Catalog\ProductTotals $productTotals,
JsonFactory $jsonFactory
) {
$this->jsonFactory = $jsonFactory;
$this->productTotals = $productTotals;
parent::__construct($context);
}
/**
* @inheritdoc
*/
public function execute()
{
$conditions = $this->getRequest()->getParam('conditionValue');
try {
$response = $this->productTotals->getProductTotals($conditions);
} catch (Exception $e) {
$response = [
'total' => 0,
'disabled' => 0,
'notVisible' => 0,
];
}
return $this->jsonFactory->create()->setData($response);
}
}
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);
namespace Magento\PageBuilder\Controller\Adminhtml\GoogleMaps;
use Magento\Framework\Controller\ResultFactory;
/**
* Class ValidateApi
*/
class ValidateApi extends \Magento\Backend\App\Action implements \Magento\Framework\App\Action\HttpPostActionInterface
{
const ADMIN_RESOURCE = 'Magento_Backend::content';
/**
* @var \Magento\PageBuilder\Model\GoogleMaps\ApiKeyValidator
*/
private $apiKeyValidator;
/**
* Constructor
*
* @param \Magento\Backend\App\Action\Context $context
* @param \Magento\PageBuilder\Model\GoogleMaps\ApiKeyValidator $apiKeyValidator
*/
public function __construct(
\Magento\Backend\App\Action\Context $context,
\Magento\PageBuilder\Model\GoogleMaps\ApiKeyValidator $apiKeyValidator
) {
parent::__construct($context);
$this->apiKeyValidator = $apiKeyValidator;
}
/**
* Send test request to Google Maps and return response
*
* @return \Magento\Framework\Controller\Result\Json
*/
public function execute()
{
$apiKey = $this->getRequest()->getParam('googleMapsApiKey');
$validationResult = $this->apiKeyValidator->validate($apiKey);
return $this->resultFactory->create(ResultFactory::TYPE_JSON)->setData($validationResult);
}
}
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);
namespace Magento\PageBuilder\Controller\Adminhtml\Stage;
use Magento\Framework\Controller\ResultFactory;
use Magento\Framework\App\Action\HttpPostActionInterface;
/**
* Preview controller to render blocks preview on Stage
*/
class Preview extends \Magento\Backend\App\Action implements HttpPostActionInterface
{
const ADMIN_RESOURCE = 'Magento_Backend::content';
/**
* @var \Magento\PageBuilder\Model\Stage\RendererPool
*/
private $rendererPool;
/**
* @var \Magento\PageBuilder\Model\Stage\Preview
*/
private $preview;
/**
* @param \Magento\Backend\App\Action\Context $context
* @param \Magento\PageBuilder\Model\Stage\RendererPool $rendererPool
* @param \Magento\PageBuilder\Model\Stage\Preview $preview
*/
public function __construct(
\Magento\Backend\App\Action\Context $context,
\Magento\PageBuilder\Model\Stage\RendererPool $rendererPool,
\Magento\PageBuilder\Model\Stage\Preview $preview
) {
parent::__construct($context);
$this->rendererPool = $rendererPool;
$this->preview = $preview;
}
/**
* Generates an HTML preview for the stage
*
* @return \Magento\Framework\App\ResponseInterface|\Magento\Framework\Controller\ResultInterface|mixed
* @throws \Exception
*/
public function execute()
{
return $this->preview->startPreviewMode(
function () {
$pageResult = $this->resultFactory->create(ResultFactory::TYPE_PAGE);
// Some template filters and directive processors expect this to be called in order to function.
$pageResult->initLayout();
$params = $this->getRequest()->getParams();
$renderer = $this->rendererPool->getRenderer($params['role']);
$result = ['data' => $renderer->render($params)];
return $this->resultFactory->create(ResultFactory::TYPE_JSON)->setData($result);
}
);
}
}
<?php
/**
*
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\PageBuilder\Controller\Adminhtml\Stage;
use Magento\Backend\App\Action\Context;
use Magento\Framework\App\Action\HttpGetActionInterface;
use Magento\Framework\View\Result\PageFactory;
/**
* Class Render
*
* Iframe to render Page Builder stage in isolation
*/
class Render extends \Magento\Backend\App\Action implements HttpGetActionInterface
{
const ADMIN_RESOURCE = 'Magento_Backend::content';
/**
* @var \Magento\Framework\View\Result\PageFactory
*/
private $pageFactory;
/**
* Render constructor.
*
* @param Context $context
* @param PageFactory $pageFactory
*/
public function __construct(
Context $context,
PageFactory $pageFactory
) {
$this->pageFactory = $pageFactory;
return parent::__construct($context);
}
/**
* Render route
*
* @return \Magento\Framework\App\ResponseInterface|\Magento\Framework\Controller\ResultInterface|mixed
*/
public function execute()
{
return $this->pageFactory->create();
}
}
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);
namespace Magento\PageBuilder\Controller\Adminhtml\Template;
use Magento\Backend\App\Action;
use Magento\Backend\App\Action\Context;
use Magento\Framework\App\Action\HttpPostActionInterface;
use Magento\Framework\Exception\LocalizedException;
use Magento\PageBuilder\Api\Data\TemplateInterface;
use Magento\PageBuilder\Api\TemplateRepositoryInterface;
use Magento\Backend\Model\View\Result\Redirect;
use Psr\Log\LoggerInterface;
/**
* Delete a template within template manager
*/
class Delete extends Action implements HttpPostActionInterface
{
const ADMIN_RESOURCE = 'Magento_PageBuilder::template_delete';
/**
* @var LoggerInterface
*/
private $logger;
/**
* @var TemplateRepositoryInterface
*/
private $templateRepository;
/**
* @param Context $context
* @param LoggerInterface $logger
* @param TemplateRepositoryInterface $templateRepository
*/
public function __construct(
Context $context,
LoggerInterface $logger,
TemplateRepositoryInterface $templateRepository
) {
parent::__construct($context);
$this->logger = $logger;
$this->templateRepository = $templateRepository;
}
/**
* Delete a template from the database
*
* @return \Magento\Framework\App\ResponseInterface|\Magento\Framework\Controller\ResultInterface
*/
public function execute()
{
/** @var Redirect $resultRedirect */
$resultRedirect = $this->resultRedirectFactory->create();
$request = $this->getRequest();
try {
$this->templateRepository->deleteById($request->getParam(TemplateInterface::KEY_ID));
$this->messageManager->addSuccessMessage(__('Template successfully deleted.'));
return $resultRedirect->setPath('*/*/');
} catch (LocalizedException $e) {
$this->messageManager->addErrorMessage($e->getMessage());
return $resultRedirect->setPath('*/*/');
} catch (\Exception $e) {
$this->logger->critical($e);
$this->messageManager->addErrorMessage(__('An error occurred while trying to delete this template.'));
return $resultRedirect->setPath('*/*/');
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment