Commit 5025ba0b authored by git's avatar git Committed by borisson_

Issue #2911763 by cato, borisson_: UUID null on config-export

parent 3f3bf5c2
......@@ -9,6 +9,7 @@ use Drupal\Core\Form\FormStateInterface;
use Drupal\facets\Entity\FacetSource;
use Drupal\facets\UrlProcessor\UrlProcessorPluginManager;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Drupal\Component\Uuid\UuidInterface;
/**
* Provides a form for editing facet sources.
......@@ -25,6 +26,13 @@ class FacetSourceEditForm extends EntityForm {
*/
protected $urlProcessorPluginManager;
/**
* The UUID generator interface
*
* @var \Drupal\facets\Form\UuidInterface
*/
protected $uuid;
/**
* {@inheritdoc}
*/
......@@ -32,7 +40,8 @@ class FacetSourceEditForm extends EntityForm {
return new static(
$container->get('entity_type.manager'),
$container->get('plugin.manager.facets.url_processor'),
$container->get('module_handler')
$container->get('module_handler'),
$container->get('uuid')
);
}
......@@ -45,11 +54,14 @@ class FacetSourceEditForm extends EntityForm {
* The url processor plugin manager.
* @param \Drupal\Core\Extension\ModuleHandlerInterface $moduleHandler
* Drupal's module handler.
* @param \Drupal\Component\Uuid\UuidInterface $uuid
* Drupal's uuid generator.
*/
public function __construct(EntityTypeManagerInterface $entity_type_manager, UrlProcessorPluginManager $url_processor_plugin_manager, ModuleHandlerInterface $moduleHandler) {
public function __construct(EntityTypeManagerInterface $entity_type_manager, UrlProcessorPluginManager $url_processor_plugin_manager, ModuleHandlerInterface $moduleHandler, UuidInterface $uuid) {
$facet_source_storage = $entity_type_manager->getStorage('facets_facet_source');
$this->urlProcessorPluginManager = $url_processor_plugin_manager;
$this->uuid = $uuid;
// Make sure we remove colons from the source id, those are disallowed in
// the entity id.
......@@ -64,10 +76,13 @@ class FacetSourceEditForm extends EntityForm {
else {
// We didn't have a facet source config entity yet for this facet source
// plugin, so we create it on the fly.
// Generate and set an uuid for config export and import to work.
$facet_source = new FacetSource(
[
'id' => $source_id,
'name' => $this->getRequest()->get('facets_facet_source'),
'is_new' => TRUE,
'uuid' => $this->uuid->generate()
],
'facets_facet_source'
);
......
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