From dfeda37295dcc43ca5adec98896ecb548bad9d88 Mon Sep 17 00:00:00 2001 From: Stephen Cameron Date: Tue, 23 Apr 2019 16:54:52 +0200 Subject: [PATCH] Adding missing custom mu-plugin files. WIP #2684 @0.25 --- .gitignore | 3 + wp-content/mu-plugins/cube-loader.php | 30 + wp-content/mu-plugins/cube/composer.json | 12 + wp-content/mu-plugins/cube/composer.lock | 904 ++++++++++++++++++ .../mu-plugins/cube/src/Common/Setup.php | 21 + .../mu-plugins/cube/src/Elementor/Setup.php | 155 +++ .../cube/src/Elementor/Widgets/HeroBlock.php | 172 ++++ .../src/Elementor/Widgets/PageHeading.php | 144 +++ .../cube/src/Elementor/Widgets/TextBlock.php | 347 +++++++ wp-content/mu-plugins/cube/src/Init.php | 42 + .../assets/styles/common/mixins.styl | 9 +- .../assets/styles/common/variables.styl | 2 +- .../assets/styles/widgets/text-block.styl | 4 +- 13 files changed, 1838 insertions(+), 7 deletions(-) create mode 100644 wp-content/mu-plugins/cube-loader.php create mode 100644 wp-content/mu-plugins/cube/composer.json create mode 100644 wp-content/mu-plugins/cube/composer.lock create mode 100644 wp-content/mu-plugins/cube/src/Common/Setup.php create mode 100644 wp-content/mu-plugins/cube/src/Elementor/Setup.php create mode 100644 wp-content/mu-plugins/cube/src/Elementor/Widgets/HeroBlock.php create mode 100644 wp-content/mu-plugins/cube/src/Elementor/Widgets/PageHeading.php create mode 100644 wp-content/mu-plugins/cube/src/Elementor/Widgets/TextBlock.php create mode 100644 wp-content/mu-plugins/cube/src/Init.php diff --git a/.gitignore b/.gitignore index 62edd71..f3ca18f 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,9 @@ node_modules /wp-content/* /wp-content/themes/index.php !/wp-content/themes/ +!/wp-content/mu-plugins/ +/wp-content/mu-plugins/cube/vendor +/wp-content/mu-plugins/wp-migrate-db-pro-compatibility.php /wp-includes /wp-admin diff --git a/wp-content/mu-plugins/cube-loader.php b/wp-content/mu-plugins/cube-loader.php new file mode 100644 index 0000000..ede46dd --- /dev/null +++ b/wp-content/mu-plugins/cube-loader.php @@ -0,0 +1,30 @@ +=5.5" + }, + "require-dev": { + "ext-curl": "*", + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.4 || ^7.0", + "psr/log": "^1.0" + }, + "suggest": { + "psr/log": "Required for using the Log middleware" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "6.3-dev" + } + }, + "autoload": { + "files": [ + "src/functions_include.php" + ], + "psr-4": { + "GuzzleHttp\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "Guzzle is a PHP HTTP client library", + "homepage": "http://guzzlephp.org/", + "keywords": [ + "client", + "curl", + "framework", + "http", + "http client", + "rest", + "web service" + ], + "time": "2018-04-22 15:46:56" + }, + { + "name": "guzzlehttp/promises", + "version": "v1.3.1", + "source": { + "type": "git", + "url": "https://github.com/guzzle/promises.git", + "reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/promises/zipball/a59da6cf61d80060647ff4d3eb2c03a2bc694646", + "reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646", + "shasum": "" + }, + "require": { + "php": ">=5.5.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4-dev" + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Promise\\": "src/" + }, + "files": [ + "src/functions_include.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "Guzzle promises library", + "keywords": [ + "promise" + ], + "time": "2016-12-20 10:07:11" + }, + { + "name": "guzzlehttp/psr7", + "version": "1.4.2", + "source": { + "type": "git", + "url": "https://github.com/guzzle/psr7.git", + "reference": "f5b8a8512e2b58b0071a7280e39f14f72e05d87c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/f5b8a8512e2b58b0071a7280e39f14f72e05d87c", + "reference": "f5b8a8512e2b58b0071a7280e39f14f72e05d87c", + "shasum": "" + }, + "require": { + "php": ">=5.4.0", + "psr/http-message": "~1.0" + }, + "provide": { + "psr/http-message-implementation": "1.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4-dev" + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Psr7\\": "src/" + }, + "files": [ + "src/functions_include.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "Tobias Schultze", + "homepage": "https://github.com/Tobion" + } + ], + "description": "PSR-7 message implementation that also provides common utility methods", + "keywords": [ + "http", + "message", + "request", + "response", + "stream", + "uri", + "url" + ], + "time": "2017-03-20 17:10:46" + }, + { + "name": "htmlburger/carbon-fields", + "version": "2.2.0", + "source": { + "type": "git", + "url": "https://github.com/htmlburger/carbon-fields.git", + "reference": "f2e7e7b306f872b606b16909d2a2ee906381d5d1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/htmlburger/carbon-fields/zipball/f2e7e7b306f872b606b16909d2a2ee906381d5d1", + "reference": "f2e7e7b306f872b606b16909d2a2ee906381d5d1", + "shasum": "" + }, + "require": { + "php": ">=5.3" + }, + "require-dev": { + "mockery/mockery": "^0.9.7", + "phpunit/phpunit": "~4.8" + }, + "type": "library", + "autoload": { + "psr-4": { + "Carbon_Fields\\": "core/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "GPL-2.0-only" + ], + "authors": [ + { + "name": "htmlBurger", + "email": "wordpress@htmlburger.com", + "homepage": "https://htmlburger.com/", + "role": "Developer" + }, + { + "name": "Marin Atanasov", + "email": "contact@marinatanasov.com", + "homepage": "http://marinatanasov.com/", + "role": "Developer" + }, + { + "name": "Siyan Panayotov", + "homepage": "http://siyanpanayotov.com/", + "role": "Developer" + }, + { + "name": "Georgi Stoyanov", + "email": "stoyanov.gs@gmail.com", + "role": "Developer" + }, + { + "name": "Stanimir Panchev", + "email": "Stan4omir@gmail.com", + "role": "Developer" + }, + { + "name": "Peter Petrov", + "email": "peter.petrov89@gmail.com", + "role": "Developer" + }, + { + "name": "Plamen Kostadinov", + "email": "pkostadinov.2create@gmail.com", + "homepage": "http://plasmen.info/", + "role": "Developer" + }, + { + "name": "Stanimir Stoyanov", + "email": "stanimir.k.stoyanov@gmail.com", + "role": "Developer" + }, + { + "name": "Georgi Popov", + "homepage": "http://magadanski.com/", + "role": "Developer" + }, + { + "name": "German Velchev", + "email": "germozy@gmail.com", + "role": "Developer" + }, + { + "name": "Rashko Petrov", + "email": "brutalenemy666@gmail.com", + "homepage": "http://errorfactory.com/", + "role": "Developer" + }, + { + "name": "Miroslav Mitev", + "email": "mmitev.2create@gmail.com", + "role": "Developer" + }, + { + "name": "Kaloyan Ivanov", + "email": "kaloyanxivanov@gmail.com", + "homepage": "http://vilepixels.com/", + "role": "Developer" + }, + { + "name": "Atanas Angelov", + "email": "atanas.angelov.dev@gmail.com", + "role": "Developer" + }, + { + "name": "Alexander Panayotov", + "email": "alexander.panayotov@gmail.com", + "homepage": "http://alexanderpanayotov.com/", + "role": "Developer" + }, + { + "name": "Viktor Vasilev", + "email": "liberalcho@gmail.com", + "role": "Developer" + } + ], + "description": "WordPress developer-friendly custom fields for post types, taxonomy terms, users, comments, widgets, options and more.", + "homepage": "http://carbonfields.net/", + "time": "2018-03-16 09:06:14" + }, + { + "name": "illuminate/contracts", + "version": "v5.6.24", + "source": { + "type": "git", + "url": "https://github.com/illuminate/contracts.git", + "reference": "3dc639feabe0f302f574157a782ede323881a944" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/illuminate/contracts/zipball/3dc639feabe0f302f574157a782ede323881a944", + "reference": "3dc639feabe0f302f574157a782ede323881a944", + "shasum": "" + }, + "require": { + "php": "^7.1.3", + "psr/container": "~1.0", + "psr/simple-cache": "~1.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.6-dev" + } + }, + "autoload": { + "psr-4": { + "Illuminate\\Contracts\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "description": "The Illuminate Contracts package.", + "homepage": "https://laravel.com", + "time": "2018-05-11 23:38:58" + }, + { + "name": "illuminate/support", + "version": "v5.6.24", + "source": { + "type": "git", + "url": "https://github.com/illuminate/support.git", + "reference": "b13296a75443797d6a71d0ccd437ca801b12d300" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/illuminate/support/zipball/b13296a75443797d6a71d0ccd437ca801b12d300", + "reference": "b13296a75443797d6a71d0ccd437ca801b12d300", + "shasum": "" + }, + "require": { + "doctrine/inflector": "~1.1", + "ext-mbstring": "*", + "illuminate/contracts": "5.6.*", + "nesbot/carbon": "^1.24.1", + "php": "^7.1.3" + }, + "conflict": { + "tightenco/collect": "<5.5.33" + }, + "suggest": { + "illuminate/filesystem": "Required to use the composer class (5.6.*).", + "ramsey/uuid": "Required to use Str::uuid() (^3.7).", + "symfony/process": "Required to use the composer class (~4.0).", + "symfony/var-dumper": "Required to use the dd function (~4.0)." + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.6-dev" + } + }, + "autoload": { + "psr-4": { + "Illuminate\\Support\\": "" + }, + "files": [ + "helpers.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "description": "The Illuminate Support package.", + "homepage": "https://laravel.com", + "time": "2018-06-02 14:30:18" + }, + { + "name": "jjgrainger/posttypes", + "version": "2.0.1", + "source": { + "type": "git", + "url": "https://github.com/jjgrainger/PostTypes.git", + "reference": "04525d30d30ec19fef3478676b4f27aa405ac3a6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/jjgrainger/PostTypes/zipball/04525d30d30ec19fef3478676b4f27aa405ac3a6", + "reference": "04525d30d30ec19fef3478676b4f27aa405ac3a6", + "shasum": "" + }, + "require": { + "php": ">=5.6" + }, + "require-dev": { + "phpunit/phpunit": "5.7", + "squizlabs/php_codesniffer": "^2.8" + }, + "type": "library", + "autoload": { + "psr-4": { + "PostTypes\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Joe Grainger", + "email": "hello@jjgrainger.co.uk", + "homepage": "http://jjgrainger.co.uk" + } + ], + "description": "Simple WordPress custom post types.", + "homepage": "https://github.com/jjgrainger/posttype", + "time": "2018-03-27 18:30:06" + }, + { + "name": "nesbot/carbon", + "version": "1.29.2", + "source": { + "type": "git", + "url": "https://github.com/briannesbitt/Carbon.git", + "reference": "ed6aa898982f441ccc9b2acdec51490f2bc5d337" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/ed6aa898982f441ccc9b2acdec51490f2bc5d337", + "reference": "ed6aa898982f441ccc9b2acdec51490f2bc5d337", + "shasum": "" + }, + "require": { + "php": ">=5.3.9", + "symfony/translation": "~2.6 || ~3.0 || ~4.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "~2", + "phpunit/phpunit": "^4.8.35 || ^5.7" + }, + "type": "library", + "autoload": { + "psr-4": { + "": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Brian Nesbitt", + "email": "brian@nesbot.com", + "homepage": "http://nesbot.com" + } + ], + "description": "A simple API extension for DateTime.", + "homepage": "http://carbon.nesbot.com", + "keywords": [ + "date", + "datetime", + "time" + ], + "time": "2018-05-29 15:23:46" + }, + { + "name": "psr/container", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/container.git", + "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/container/zipball/b7ce3b176482dbbc1245ebf52b181af44c2cf55f", + "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Container\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common Container Interface (PHP FIG PSR-11)", + "homepage": "https://github.com/php-fig/container", + "keywords": [ + "PSR-11", + "container", + "container-interface", + "container-interop", + "psr" + ], + "time": "2017-02-14 16:28:37" + }, + { + "name": "psr/http-message", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-message.git", + "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363", + "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Message\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for HTTP messages", + "homepage": "https://github.com/php-fig/http-message", + "keywords": [ + "http", + "http-message", + "psr", + "psr-7", + "request", + "response" + ], + "time": "2016-08-06 14:39:51" + }, + { + "name": "psr/simple-cache", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/php-fig/simple-cache.git", + "reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/simple-cache/zipball/408d5eafb83c57f6365a3ca330ff23aa4a5fa39b", + "reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\SimpleCache\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interfaces for simple caching", + "keywords": [ + "cache", + "caching", + "psr", + "psr-16", + "simple-cache" + ], + "time": "2017-10-23 01:57:42" + }, + { + "name": "symfony/polyfill-mbstring", + "version": "v1.8.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "3296adf6a6454a050679cde90f95350ad604b171" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/3296adf6a6454a050679cde90f95350ad604b171", + "reference": "3296adf6a6454a050679cde90f95350ad604b171", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "suggest": { + "ext-mbstring": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.8-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for the Mbstring extension", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "mbstring", + "polyfill", + "portable", + "shim" + ], + "time": "2018-04-26 10:06:28" + }, + { + "name": "symfony/translation", + "version": "v4.1.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/translation.git", + "reference": "16328f5b217cebc8dd4adfe4aeeaa8c377581f5a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/translation/zipball/16328f5b217cebc8dd4adfe4aeeaa8c377581f5a", + "reference": "16328f5b217cebc8dd4adfe4aeeaa8c377581f5a", + "shasum": "" + }, + "require": { + "php": "^7.1.3", + "symfony/polyfill-mbstring": "~1.0" + }, + "conflict": { + "symfony/config": "<3.4", + "symfony/dependency-injection": "<3.4", + "symfony/yaml": "<3.4" + }, + "require-dev": { + "psr/log": "~1.0", + "symfony/config": "~3.4|~4.0", + "symfony/console": "~3.4|~4.0", + "symfony/dependency-injection": "~3.4|~4.0", + "symfony/finder": "~2.8|~3.0|~4.0", + "symfony/intl": "~3.4|~4.0", + "symfony/yaml": "~3.4|~4.0" + }, + "suggest": { + "psr/log-implementation": "To use logging capability in translator", + "symfony/config": "", + "symfony/yaml": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.1-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Translation\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Translation Component", + "homepage": "https://symfony.com", + "time": "2018-05-30 07:26:09" + } + ], + "packages-dev": [], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": [], + "platform-dev": [] +} diff --git a/wp-content/mu-plugins/cube/src/Common/Setup.php b/wp-content/mu-plugins/cube/src/Common/Setup.php new file mode 100644 index 0000000..d077775 --- /dev/null +++ b/wp-content/mu-plugins/cube/src/Common/Setup.php @@ -0,0 +1,21 @@ +register_customisations(); + + // Register widgets with Elementor + add_action('elementor/widgets/widgets_registered', [$this, 'register_widgets']); + } + + + public function register_customisations() { + + $this->_customise_sections(); + $this->_customise_image_widget(); + + } + + + public function register_widgets() { + + $elementor = Plugin::$instance; + + $elementor->widgets_manager->register_widget_type( new Widgets\PageHeading() ); + $elementor->widgets_manager->register_widget_type( new Widgets\HeroBlock() ); + $elementor->widgets_manager->register_widget_type( new Widgets\TextBlock() ); + } + + protected function _customise_sections() { + + // Override the main Elementor section element to allow custom controls to be added to the editor + // This allows us to set specific CSS classes on the section wrapper, thereby centralising control + // of necessary settings for each section layout (column width, padding etc) + // + // References: + // https://www.ibenic.com/extending-elementor-custom-button-field-skin/ + // https://blogs.devforum.ro/customizing-elementor-default-widgets/ + // https://github.com/pojome/elementor/issues/3495 + + // Add controls to section element in editor + add_action( 'elementor/element/section/section_layout/after_section_start', function( $element, $args ) { + /** @var \Elementor\Element_Base $element */ + $element->add_control( + 'block_layout', + [ + 'label' => __('Custom Layout', 'cube'), + 'type' => Controls_Manager::SELECT, + 'options' => [ + 'layout-default' => __( 'Default', 'cube' ), + 'layout-overlap-above' => __( 'Overlap Above', 'cube' ), + 'layout-overlap-below' => __( 'Overlap Below', 'cube' ), + ], + 'default' => 'layout-default', + 'prefix_class' => '', // Use the full value as the classname (too late to change values after many pages have been built) + ] + ); + + $element->add_control( + 'layout_reversed', + [ + 'label' => __('Reverse layout?', 'cube'), + 'type' => Controls_Manager::SWITCHER, + 'default' => '', + 'return_value' => 'layout-reversed', + 'prefix_class' => '', + ] + ); + + $element->add_control( + 'padding_top', + [ + 'label' => __('Disable padding top', 'cube'), + 'type' => Controls_Manager::SWITCHER, + 'default' => '', + 'return_value' => 'pt0', + 'prefix_class' => '', + ] + ); + + $element->add_control( + 'padding_bottom', + [ + 'label' => __('Disable padding bottom', 'cube'), + 'type' => Controls_Manager::SWITCHER, + 'default' => '', + 'return_value' => 'pb0', + 'prefix_class' => '', + ] + ); + + }, 10, 2 ); + + + //--- Section shape divider + // Add a CSS class based on the shape divider type so we can style accordingly + // (extra padding needed when a divider is present) + add_action( 'elementor/element/section/section_shape_divider/before_section_end', function( $element, $args ) { + $elementor = Plugin::instance(); + + // Get the shape divider controls for updating + $divider_top = $elementor->controls_manager->get_control_from_stack( $element->get_name(), 'shape_divider_top' ); + $divider_bottom = $elementor->controls_manager->get_control_from_stack( $element->get_name(), 'shape_divider_bottom' ); + + if (is_wp_error($divider_top) || is_wp_error($divider_top)) { + return; + } + + // Add a prefix class so section will have a class that matches the divider type(s) + $divider_top['prefix_class'] = 'divider-top-'; + $divider_top['render_type'] = 'template'; // Needed so class will be applied immediately in the editor + $element->update_control( 'shape_divider_top', $divider_top ); + $divider_bottom['prefix_class'] = 'divider-bottom-'; + $divider_bottom['render_type'] = 'template'; // Needed so class will be applied immediately in the editor + $element->update_control( 'shape_divider_bottom', $divider_bottom ); + }, 10, 2); + + } + + protected function _customise_image_widget() { + + // Add controls to image widget in editor + add_action( 'elementor/element/image/section_image/before_section_end', function( $element, $args ) { + + /** @var \Elementor\Element_Base $element */ + $element->add_control( + 'link_icon', + [ + 'label' => __( 'Link Icon', 'cube' ), + 'type' => Controls_Manager::SELECT, + 'options' => [ + '' => __( 'None', 'cube' ), + 'tour-360' => __( '360 Tour', 'cube' ), + 'enlarge' => __( 'Enlarge', 'cube' ), + ], + 'default' => '', + 'prefix_class' => 'icon-', + 'condition' => [ + 'link_to!' => 'none', + ], + ] + ); + }, 10, 2); + + } + +} diff --git a/wp-content/mu-plugins/cube/src/Elementor/Widgets/HeroBlock.php b/wp-content/mu-plugins/cube/src/Elementor/Widgets/HeroBlock.php new file mode 100644 index 0000000..2f55f8b --- /dev/null +++ b/wp-content/mu-plugins/cube/src/Elementor/Widgets/HeroBlock.php @@ -0,0 +1,172 @@ +start_controls_section( + 'section_image', + [ + 'label' => __( 'Hero Block', 'cube' ), + ] + ); + + $this->add_control( + 'title', + [ + 'label' => __( 'Title', 'elementor' ), + 'type' => Controls_Manager::TEXTAREA, + 'placeholder' => __( 'Enter your title', 'elementor' ), + 'default' => '', + ] + ); + + $this->add_control( + 'body', + [ + 'label' => __('Body', 'cube'), + 'type' => Controls_Manager::TEXTAREA, + 'default' => '', + ] + ); + + $this->add_control( + 'image', + [ + 'label' => __( 'Background Image', 'elementor' ), + 'type' => Controls_Manager::MEDIA, + 'default' => [ + 'url' => Utils::get_placeholder_image_src(), + ], + ] + ); + + $this->add_control( + 'arrow_link', + [ + 'label' => __( 'Arrow link', 'cube' ), + 'type' => Controls_Manager::TEXT, + 'placeholder' => __( 'URL / anchor link', 'cube' ), + 'default' => '#content', + ] + ); + + $this->end_controls_section(); + } + /** + * Render the widget output on the frontend. + * Written in PHP and used to generate the final HTML. + * + * @since 1.0.0 + * @access protected + */ + protected function render() { + + $id = 'hero_' . $this->get_id(); + $title = $this->get_settings('title'); + $body = $this->parse_text_editor($this->get_settings('body')); + $image = $this->get_settings('image'); + $arrow_link = $this->get_settings('arrow_link'); + + // When this element is present, add a class to the body so the header can be styled differently (inverted colours) + add_filter('body_class', function($classes) { + $classes[] = 'hero-header'; + return $classes; + }); + + + ?> + +
+ +
+ +
+

+
+ +
+ + +
+
+
+ +
+ + + + start_controls_section( + 'section_content', + [ + 'label' => __( 'Content', 'cube' ), + ] + ); + + $this->add_control( + 'subtitle', + [ + 'label' => __('Subtitle', 'cube'), + 'type' => Controls_Manager::TEXT, + 'default' => '' + ] + ); + + $this->add_control( + 'title', + [ + 'label' => __( 'Title', 'elementor' ), + 'type' => Controls_Manager::TEXTAREA, + 'placeholder' => __( 'Enter your title', 'elementor' ), + 'default' => '', + ] + ); + + + $this->end_controls_section(); + + } + /** + * Render the widget output on the frontend. + * Written in PHP and used to generate the final HTML. + * + * @since 1.0.0 + * @access protected + */ + protected function render() { + + $subtitle = $this->get_settings('subtitle'); + $title = $this->get_settings('title'); + + + // Inline Editing settings + $this->add_inline_editing_attributes('subtitle', 'none'); + $this->add_inline_editing_attributes('title', 'none'); + + // CSS Classes for elements + $this->add_render_attribute('subtitle', 'class', ['page-heading-subtitle']); + $this->add_render_attribute('title', 'class', ['page-heading-title']); + + + // Rendered content + echo '
'; + if (!empty($subtitle)) echo "

get_render_attribute_string('subtitle')}>$subtitle

"; + if (!empty($title)) echo "

get_render_attribute_string('title')}>$title

"; + echo '
'; + } + + /** + * Render text editor widget output in the editor. + * + * Written as a Backbone JavaScript template and used to generate the live preview. + * + * @since 1.0.0 + * @access protected + */ + protected function _content_template() { + ?> + <# + view.addRenderAttribute( 'subtitle', 'class', ['page-heading-subtitle']); + view.addRenderAttribute( 'title', 'class', ['page-heading-title']); + + view.addInlineEditingAttributes( 'subtitle', 'none' ); + view.addInlineEditingAttributes( 'title', 'none' ); + #> +
+ + <# if ('' !== settings.subtitle) { #> +

{{{ settings.subtitle }}}

+ <# } #> + + <# if ('' !== settings.title) { #> +

{{{ settings.title }}}

+ <# } #> + +
+ start_controls_section( + 'section_content', + [ + 'label' => __( 'Content', 'cube' ), + ] + ); + + + $this->add_control( + 'subtitle', + [ + 'label' => __( 'Subtitle', 'cube' ), + 'type' => Controls_Manager::TEXT, + 'default' => '', + ] + ); + + $this->add_control( + 'title', + [ + 'label' => __( 'Title', 'elementor' ), + 'type' => Controls_Manager::TEXTAREA, + 'placeholder' => __( 'Enter your title', 'elementor' ), + 'default' => '', + ] + ); + + $this->add_control( + 'title_decoration', + [ + 'label' => __( 'Hide title decoration?', 'cube' ), + 'type' => Controls_Manager::SWITCHER, + 'selectors' => [ + "{{WRAPPER}} .text-block-title:after" => 'display: none', + ], + 'condition' => [ + "title!" => '', + ], + ] + ); + + $this->add_control( + 'body', + [ + 'label' => __('Body', 'cube'), + 'type' => Controls_Manager::WYSIWYG, + 'default' => '', + ] + ); + + $this->add_control( + 'cta_text', + [ + 'label' => __('Call to Action text', 'cube'), + 'type' => Controls_Manager::TEXT, + 'default' => '' + ] + ); + + $this->add_control( + 'cta_link', + [ + 'label' => __('Call to Action link', 'cube'), + 'type' => Controls_Manager::URL, + 'default' => [ + 'url' => '', + 'is_external' => false, + ], + 'show_external' => true + ] + ); + + $this->end_controls_section(); + + + $this->start_controls_section( + 'section_formatting', + [ + 'label' => __( 'Colours & Formatting', 'cube' ), + ] + ); + + + + $this->add_control( + 'title_size', + [ + 'label' => __( 'Title Size', 'cube' ), + 'type' => Controls_Manager::SELECT, + 'options' => [ + '' => __( 'Default', 'cube' ), + 'medium' => __( 'Medium', 'cube' ), + ], + 'default' => '', + ] + ); + + $this->add_control( + 'title_color', + [ + 'label' => __( 'Title Colour', 'cube' ), + 'type' => Controls_Manager::COLOR, + 'default' => '', + 'selectors' => [ + '{{WRAPPER}} .text-block-title' => 'color: {{VALUE}};', + ], + ] + ); + + + $this->add_control( + 'body_color', + [ + 'label' => __( 'Body Colour', 'cube' ), + 'type' => Controls_Manager::COLOR, + 'default' => '', + 'selectors' => [ + '{{WRAPPER}} .text-block-body' => 'color: {{VALUE}};', + ], + ] + ); + + + $this->add_control( + 'cta_color', + [ + 'label' => __( 'Call to Action Colour', 'cube' ), + 'type' => Controls_Manager::COLOR, + 'default' => '', + 'selectors' => [ + '{{WRAPPER}} .text-block-cta' => 'color: {{VALUE}};', + ], + ] + ); + + + $this->add_responsive_control( + 'align', + [ + 'label' => __( 'Alignment', 'elementor' ), + 'type' => Controls_Manager::CHOOSE, + 'options' => [ + 'left' => [ + 'title' => __( 'Left', 'elementor' ), + 'icon' => 'fa fa-align-left', + ], + 'center' => [ + 'title' => __( 'Center', 'elementor' ), + 'icon' => 'fa fa-align-center', + ], + 'right' => [ + 'title' => __( 'Right', 'elementor' ), + 'icon' => 'fa fa-align-right', + ], + 'justify' => [ + 'title' => __( 'Justified', 'elementor' ), + 'icon' => 'fa fa-align-justify', + ], + ], + 'default' => '', + 'selectors' => [ + '{{WRAPPER}}' => 'text-align: {{VALUE}}; margin: 0 auto;', + ], + ] + ); + + $this->add_control( + 'max_width', + [ + 'label' => __( 'Maximum Width', 'cube' ), + 'type' => Controls_Manager::SLIDER, + // 'default' => [ + // 'size' => 400, + // ], + 'range' => [ + 'px' => [ + 'min' => 400, + 'max' => 1600, + 'step' => 10, + ], + '%' => [ + 'min' => 0, + 'max' => 100, + ], + ], + 'selectors' => [ + '{{WRAPPER}} .text-block' => 'max-width: {{SIZE}}{{UNIT}};', + ], + ] + ); + + $this->end_controls_section(); + } + /** + * Render the widget output on the frontend. + * Written in PHP and used to generate the final HTML. + * + * @since 1.0.0 + * @access protected + */ + protected function render() { + + $subtitle = $this->get_settings('subtitle'); + $title = $this->get_settings('title'); + $title_size = $this->get_settings('title_size'); + $body = $this->parse_text_editor($this->get_settings('body')); + $cta_text = $this->get_settings('cta_text'); + $cta_link = $this->get_settings('cta_link'); + + if ( ! empty( $cta_link['url'] ) ) { + $this->add_render_attribute( 'cta_text', 'href', $cta_link['url'] ); + + if ( $cta_link['is_external'] ) { + $this->add_render_attribute( 'cta_text', 'target', '_blank' ); + } + + if ( $cta_link['nofollow'] ) { + $this->add_render_attribute( 'cta_text', 'rel', 'nofollow' ); + } + } + + // Inline Editing settings + $this->add_inline_editing_attributes('subtitle', 'none'); + $this->add_inline_editing_attributes('title', 'none'); + $this->add_inline_editing_attributes('body', 'advanced'); + $this->add_inline_editing_attributes('cta_text', 'none'); + + // CSS Classes for elements + $this->add_render_attribute('subtitle', 'class', ['text-block-subtitle']); + $this->add_render_attribute('title', 'class', ['text-block-title']); + $this->add_render_attribute('body', 'class', ['text-block-body']); + $this->add_render_attribute('cta_text', 'class', ['text-block-cta arrow-link']); + + if (!empty($title_size)) { + $this->add_render_attribute('title', 'class', ["text-block-title-size-{$title_size}"]); + } + + // Rendered content + echo '
'; + if (!empty($subtitle)) echo "

get_render_attribute_string('subtitle')}>$subtitle

"; + if (!empty($title)) echo "

get_render_attribute_string('title')}>$title

"; + if (!empty($body)) echo "
get_render_attribute_string('body')}>$body
"; + if (!empty($cta_text)) { + echo "get_render_attribute_string('cta_text')}>". \BladeSvgSage\svg_image('arrow')->toHtml() ." $cta_text"; + } + echo '
'; + } + + /** + * Render text editor widget output in the editor. + * + * Written as a Backbone JavaScript template and used to generate the live preview. + * + * @since 1.0.0 + * @access protected + */ + protected function _content_template() { + ?> + <# + view.addRenderAttribute( 'subtitle', 'class', ['text-block-subtitle']); + view.addRenderAttribute( 'title', 'class', ['text-block-title']); + view.addRenderAttribute( 'body', 'class', ['text-block-body']); + view.addRenderAttribute( 'cta_text', 'class', ['text-block-cta arrow-link']); + + if ('' !== settings.title_size) { + view.addRenderAttribute('title', 'class', ['text-block-title-size-' + settings.title_size]); + } + + view.addInlineEditingAttributes( 'subtitle', 'none' ); + view.addInlineEditingAttributes( 'title', 'none' ); + view.addInlineEditingAttributes( 'body', 'advanced' ); + view.addInlineEditingAttributes( 'cta_text', 'none' ); + #> +
+ + <# if ('' !== settings.subtitle) { #> +

{{{ settings.subtitle }}}

+ <# } #> + + <# if ('' !== settings.title) { #> +

{{{ settings.title }}}

+ <# } #> + + <# if ('' !== settings.body) { #> +
{{{ settings.body }}}
+ <# } #> + + <# if ('' !== settings.cta_text) { #> + toHtml() ?> {{{ settings.cta_text }}} + <# } #> + +
+ register(); + } + } + } + + /** + * @param class $class Class from the services array + * @return class instance New instance of the class + */ + private static function instantiate($class) { + return new $class(); + } +} diff --git a/wp-content/themes/c6/resources/assets/styles/common/mixins.styl b/wp-content/themes/c6/resources/assets/styles/common/mixins.styl index 704a8ed..e01ccc2 100644 --- a/wp-content/themes/c6/resources/assets/styles/common/mixins.styl +++ b/wp-content/themes/c6/resources/assets/styles/common/mixins.styl @@ -53,10 +53,11 @@ inline-list() // Inspired by: https://davidwalsh.name/stylus-rem font-size(value, arguments...) - // Handle special case of setting base font size on html element - // In this case, we don't want pixel value converted to a REM - // Also bail out if 'inherit' is the value - if (selector() is 'html' || value is 'inherit') { + // Handle special cases first: + // 1) Allow disabling of this conversion by including the word "fixed" after the value + // 2) Don't do any conversion when setting on the html selector (because it is the root!) + // 3) Leave alone if 'inherit' is the value + if (arguments is 'fixed' || selector() is 'html' || value is 'inherit') { font-size: value } else { // Only px values are converted to rem but we still want to use the px value as a fallback diff --git a/wp-content/themes/c6/resources/assets/styles/common/variables.styl b/wp-content/themes/c6/resources/assets/styles/common/variables.styl index fa56466..45e6352 100644 --- a/wp-content/themes/c6/resources/assets/styles/common/variables.styl +++ b/wp-content/themes/c6/resources/assets/styles/common/variables.styl @@ -10,7 +10,7 @@ $vertical-gutter = 2.5vw $font = 'Muli', sans-serif // Font sizing -$font-size-base = 20px // Size of 1rem +$font-size-base = 16px // Size of 1rem $font-size-extra-large = 81px $font-size-large = 54px $font-size-medium = 45px diff --git a/wp-content/themes/c6/resources/assets/styles/widgets/text-block.styl b/wp-content/themes/c6/resources/assets/styles/widgets/text-block.styl index 5afd862..0daeb94 100644 --- a/wp-content/themes/c6/resources/assets/styles/widgets/text-block.styl +++ b/wp-content/themes/c6/resources/assets/styles/widgets/text-block.styl @@ -61,8 +61,8 @@ color: $colors.orange &-cta - //font-smoothing() - font-size: 12px + font-smoothing() + font-size: 12px fixed // Won't be converted to rems font-weight: 800 text-transform: uppercase display: inline-block -- 2.39.5