This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: website | |
recipe: drupal9 | |
config: | |
webroot: docroot | |
php: 8.0 | |
database: mysql:5.7 | |
xdebug: "debug,coverage" | |
composer_version: '2' | |
config: | |
php: .vscode/php.ini # PHP Xdebug setting https://docs.lando.dev/guides/lando-with-vscode.html#getting-started |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Get block configuration. | |
$config = $this->getConfiguration(); | |
// Initiate tag cloud plugin manager. | |
$tag_cloud_manager = \Drupal::service('plugin.manager.tag_cloud'); | |
// Create instance of user selected tag cloud plugin style and execute build method. | |
return $tag_cloud_manager | |
->createInstance($config['style']) | |
->build($terms); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Get all defined plugins of plugin type tag_cloud. Where the definition is simply annotation value. | |
$tag_cloud_plugin_definitions = \Drupal::service('plugin.manager.tag_cloud')->getDefinitions(); | |
$tag_cloud_styles = []; | |
// Create form select option array with key as plugin id. | |
foreach ($tag_cloud_plugin_definitions as $plugin_id => $plugin_definition) { | |
$tag_cloud_styles[$plugin_id] = $plugin_definition['label']->render(); | |
} | |
$form['style'] = [ | |
'#type' => 'select', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Drupal\dynamictagclouds\Plugin\TagCloud; | |
use Drupal\dynamictagclouds\Plugin\TagCloudBase; | |
/** | |
* Default tag cloud style. | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Drupal\dynamictagclouds\Plugin; | |
use Drupal\Component\Plugin\PluginBase; | |
/** | |
* Base class for Tag cloud plugins. | |
*/ | |
abstract class TagCloudBase extends PluginBase implements TagCloudInterface { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Drupal\dynamictagclouds\Plugin\TagCloud; | |
use Drupal\dynamictagclouds\Plugin\TagCloudInterface; | |
/** | |
* @TagCloud( | |
* id = "default_tag_cloud", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Drupal\commerce_shipping\Packer; | |
use Drupal\Core\Entity\EntityTypeManagerInterface; | |
use Drupal\commerce_order\Entity\OrderInterface; | |
use Drupal\profile\Entity\ProfileInterface; | |
use Drupal\commerce_shipping\Packer\PackerInterface; | |
/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
custom_module.custom_packer: | |
class: Drupal\custom_module\Packer\CustomPacker | |
arguments: ['@entity_type.manager'] | |
tags: | |
- { name: commerce_shipping.packer, priority: 0 } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* {@inheritdoc} | |
*/ | |
public function pack(OrderInterface $order, ProfileInterface $shipping_profile) { | |
$proposed_shipments = []; | |
$packages = [ | |
'vendor_one' => [], | |
'vendor_two' => [], | |
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* {@inheritdoc} | |
*/ | |
public function applies(OrderInterface $order, ProfileInterface $shipping_profile) { | |
return $shipping_profile->address->country_code != 'CN'; | |
} |
NewerOlder