Skip to content

Instantly share code, notes, and snippets.

<?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;
/**
Problem:
When I was trying to setup commerce 2.x in Drupal 8 using Acquia cloud. Faced an issue while enabling Address module.
Error I was getting is `Address requires the commerceguys/zone library.`.
But, when I checked vendor directory, in commerceguys libraries only zone is missing in Acquia cloud,
but the same is present in my local instance.
Solution:
Commerceguys zone library is installed from git repo, so it was having `.git/`.
In Acquia cloud sub respository won't be supported.
return array(
MyPlugin => array(
'label' => t('Image Popup'),
'image' => drupal_get_path('module', my_module) . '/js/plugins/myplugin/icons/myplugin.png',
),
);
$image_data = $form_state->getUserInput()['editor_object'];
$response->addCommand(new EditorDialogSave($form_state->getValues()));
$response->addCommand(new CloseModalDialogCommand());
public function getFile() {
return drupal_get_path('module', my_module) . '/js/plugins/myplugin/plugin.js';
}
my_module.image_dialog:
path: '/my_module/dialog/image/{filter_format}'
defaults:
_form: '\Drupal\my_module\Form\EditorImagePopupDialog'
_title: 'Upload image'
options:
_theme: ajax_base_page
requirements:
_entity_access: 'filter_format.use'
(function ($, Drupal, CKEDITOR) {
var myPluginSaveCallback = function(data) {
var content = data.image_render;
insertContent(content);
};
CKEDITOR.plugins.add('myplugin', {
icons: 'imagepopup',
hidpi: true,
beforeInit: function (editor) {
// Implementation before initializing plugin.
function my_module_ckeditor_plugin_info_alter(array &$plugins) {
$plugins[myplugin] = array(
'id' => myplugin,
'label' => t('My Plugin'),
'module' => my_module,
'class' => 'Drupal\my_module\Plugin\CKEditorPlugin\MyPlugin,
'provider' => my_module,
);
}