hey, how about hooks like field_values_init
or translation_create
. The second one is used by the path
module here... and since this hook is not in the EntityEvents::$hookToEventMap
array it's never being executed.
Because of that, I have a problem with saving URL aliases for translatable content (when I save a translation, its URL alias is not saved, it's empty after saving the translation, although it shows in the form).
I made a quick fix for that:
// Dispatch an event for the entity-level hook (i.e., hook_entity_$hook).
if (isset(EntityEvents::$hookToEventMap[$hook])) {
$event_dispatcher->dispatch($event, EntityEvents::$hookToEventMap[$hook]);
} else {
$this->moduleHandler()->invokeAll('entity_' . $hook, [$entity]);
}
... and it helped in my case, but I'm not sure if it's a correct way to go.
I'm using Drupal 10.3.9.
Any progress?
Thanks er.garg.karan for the patch. I needed to adjust it a little, but it worked fine for me.
hey, I have a very similar issue, but in my case, I cannot see published translation of article, when its original translation is unpublished. I'm using JSON:API together with the View Unpublished → module.
This module provides view any unpublished content
and view any unpublished {node_type} content
permissions.
I'm basically using only the first one, which is assigned to couple of authenticated user roles (i.e. Content editor
). Anonymous users have access to published content only.
I'm using Drupal as a content repository, in a decoupled approach, and the front-end is consuming data from Drupal via JSON:API by sending requests to Drupal without any authentication (as anonymous user).
I have two languages configured in Drupal and when I create i.e. an article in English (without publishing this translation) and then translate it to Danish (with publishing it)... when I go to /da/jsonapi/node/article
I cannot see this published translation. Same is when using filters /da/jsonapi/node/article?filter[drupal_internal__nid]={nid}
... but when I go directly to the article here /da/jsonapi/node/article/{uuid}
then I get all the data, without any problems.
If I do it other way around, so I publish original English translation and unpublish additional Danish translation, then everything works as expected (English translations are visible on resource list, filters are working, Danish translations are not accessible, etc).
Long story short... if I don't publish original translation then any other published translation is not visible on the resource list (/da/jsonapi/node/article
) - with or without using filters, but is visible when asking directly for it (/da/jsonapi/node/article/{uuid}
).
Is there any workaround for this?
I was trying to use the hook mentioned in #7, but it didn't help, even in this form:
function mymodule_jsonapi_entity_filter_access($entity_type, $account): array {
return ([
JSONAPI_FILTER_AMONG_ALL => AccessResult::allowed(),
]);
}
Great, thanks
Thanks @idebr
Hey, could you please make this patch working with Drupal 10.2?
tivi22 → created an issue. See original summary → .
FYI I did a temporary solution and it works great in my case. All I did was providing custom CSS styles:
/* Layouts */
.js-lpb-component-list .lpb-layout:not(:first-child) {
margin-top: 50px;
}
.lpb-layout > .field + .layout {
margin-top: 20px;
}
/* Components */
.js-lpb-component {
margin-bottom: 10px;
border: 1px dashed #999;
}
.js-lpb-component:not(.lpb-layout) > .field {
padding: 5px 15px;
}
.js-lpb-component:not(.lpb-layout) > .lpb-controls + .field {
border-top: 1px dashed #999;
}
.lp-builder:not(.is-navigating) .js-lpb-component:hover .js-lpb-region:hover,
.lp-builder:not(.is-navigating) .js-lpb-component:focus-within .js-lpb-region:focus-within,
.js-lpb-component:hover .js-lpb-region,
.js-lpb-component:focus-within .js-lpb-region {
outline-width: 0;
}
/* Controls */
.lpb-controls {
opacity: 1;
z-index: 50;
}
.lpb-controls:hover,
.lpb-controls:focus-within {
z-index: 60;
}
.lpb-controls:not(.is-layout) {
position: relative;
box-shadow: none;
background-color: #ededed;
}
Yep, I've just installed Layout Paragraphs module in ver. 1.0.0 and it works very well. Please, take a look at scr. Is it possible to restore this feature?
Thank you for the patch. Is it possible to make this label permanent/always visible (maybe in the top right corner, I think this feature worked in 1.x version)? In my case, the label displays only once and when I save a paragraph, it disappears (even when I don't fill any field).
I had the same need to open selected env always in a new browser tab, so I used a quick patch for this case. Maybe someone will find it useful.
Hi, is it possible to add a patch working with 2.0.3
version?
Hi, did you set this field enhancer both on server & client instances?