OK I double check and it does not work. Here' s a fix for ManageComponentAttributesForm.php
<?php
namespace Drupal\layout_builder_component_attributes\Form;
use CssLint\Linter;
use Drupal\Component\Utility\Html;
use Drupal\Core\Ajax\AjaxFormHelperTrait;
use Drupal\Core\Config\ConfigFactory;
use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\layout_builder\Controller\LayoutRebuildTrait;
use Drupal\layout_builder\LayoutBuilderHighlightTrait;
use Drupal\layout_builder\SectionStorageInterface;
use Drupal\layout_builder\LayoutTempstoreRepositoryInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
class ManageComponentAttributesForm extends FormBase implements FormInterface {
use AjaxFormHelperTrait;
use LayoutBuilderHighlightTrait;
use LayoutRebuildTrait;
protected $sectionStorage;
protected $delta;
protected $uuid;
protected $layoutTempstore;
protected $configFactory;
public function __construct(LayoutTempstoreRepositoryInterface $layout_tempstore_repository, ConfigFactory $config_factory) {
$this->layoutTempstore = $layout_tempstore_repository;
$this->configFactory = $config_factory;
}
public static function create(ContainerInterface $container) {
return new static(
$container->get('layout_builder.tempstore_repository'),
$container->get('config.factory')
);
}
public function getFormId() {
return 'layout_builder_manage_attributes_form';
}
public function buildForm(array $form, FormStateInterface $form_state, SectionStorageInterface $section_storage = NULL, $delta = NULL, $uuid = NULL) {
if (!$section_storage || $delta === NULL || !$uuid) {
throw new \InvalidArgumentException('ManageComponentAttributesForm requires all parameters.');
}
$this->sectionStorage = $section_storage;
$this->delta = $delta;
$this->uuid = $uuid;
$config = $this->configFactory->get('layout_builder_component_attributes.settings')->get();
$section = $section_storage->getSection($delta);
$component = $section->getComponent($uuid);
$component_attributes = $component->get('component_attributes') ?? [];
$form['#attributes']['data-layout-builder-target-highlight-id'] = $this->blockUpdateHighlightId($uuid);
$attribute_categories = [
'block_attributes' => $this->t('Block attributes'),
'block_title_attributes' => $this->t('Block title attributes'),
'block_content_attributes' => $this->t('Block content attributes'),
];
foreach ($attribute_categories as $category => $title) {
if ($this->hasAllowedAttributes($config["allowed_$category"])) {
$form[$category] = $this->buildAttributeFieldset($title, $config["allowed_$category"], $component_attributes[$category] ?? []);
}
}
$form['actions']['submit'] = [
'#type' => 'submit',
'#value' => $this->t('Update'),
'#button_type' => 'primary',
'#ajax' => $this->isAjax() ? ['callback' => '::ajaxSubmit'] : [],
];
$form['#tree'] = TRUE;
return $form;
}
// Rest of the existing methods remain the same...
}
Here's a fix for layout_builder_component_attributes.routing.yml
layout_builder_component_attributes.settings:
path: '/admin/config/content/layout-builder-component-attributes'
defaults:
_form: '\Drupal\layout_builder_component_attributes\Form\GlobalSettingsForm'
_title: 'Layout Builder Component Attributes Settings'
requirements:
_permission: 'administer layout builder component attributes'
layout_builder_component_attributes.manage_attributes:
path: '/layout_builder/update/block-attributes/{section_storage_type}/{section_storage}/{delta}/{uuid}'
defaults:
_form: '\Drupal\layout_builder_component_attributes\Form\ManageComponentAttributesForm'
_title: 'Manage attributes'
requirements:
_permission: 'manage layout builder component attributes'
_layout_builder_access: 'view'
options:
_admin_route: TRUE
parameters:
section_storage:
layout_builder_tempstore: TRUE
Should now work with any fieldable entity.
Actually it does work but it looks like I have a few theme issues going on. Apols
tonyhrx β created an issue.
The dependency for the entity display repository service is not being assigned to a class property. Here's a patch.
--- a/CivicrmEntityAddressLeafletMap.php
+++ b/CivicrmEntityAddressLeafletMap.php
@@ -38,6 +38,13 @@ class CivicrmEntityAddressLeafletMap extends LeafletMap implements ContainerFactor
*/
class CivicrmEntityAddressLeafletMap extends LeafletMap implements ContainerFactoryPluginInterface {
+ /**
+ * The entity display repository.
+ *
+ * @var \Drupal\Core\Entity\EntityDisplayRepositoryInterface
+ */
+ protected $entityDisplay;
+
/**
* {@inheritdoc}
*/
@@ -56,7 +63,10 @@ class CivicrmEntityAddressLeafletMap extends LeafletMap implements ContainerFactor
$container->get('link_generator'),
$container->get('plugin.manager.field.field_type')
);
- return new self(
+
+ // Assign the entity display repository service to the class property
+ $instance->entityDisplay = $container->get('entity_display.repository');
+
+ return $instance;
}
If it's any help I did not use the solution #6 I used this
URL: /jsonapi/profile/myprofile?filter[uid.entity.uid]=1
and it worked for me.
tonyhrx β created an issue.
tonyhrx β created an issue.
Hi
Close this bug - it works fine on a vanilla site - must be my server environment or a module clash. Apols.
tonyhrx β created an issue.
It just does not work for me iin D10 and I'm seeing the issue queue is over 5 years old so it's not well maintained.
Simple Hide Node Title β is a bit more fiddly to set up but does work.
This issue also there with Activity Type Ids
tonyhrx β created an issue.
tonyhrx β created an issue.