Stack Exchange - Drupal Answers
202 FOLLOWERS
Drupal Q&A is a question and answer site for Drupal developers and administrators.
Stack Exchange - Drupal Answers
1d ago
I have a view that includes HTML from a rich text field. Im trying to render the HTML in a twig template but it does not work. Tried {{ output | raw }} also autoescape.
Here's how it looks in the Inspector
Any ideas how I can render this ..read more
Stack Exchange - Drupal Answers
1d ago
Hello. I did a clean install of my drupal 7 website because of an issue, but now I am unable to upload any file (image, gff, fasta etc). I am trying to upload a gff file. I have tried using my own gff as well as the one given as sample here https://tripal.readthedocs.io/en/latest/user_guide/example_genomics/genomes_genes.html. I have even tried loading a custom logo at theme settings but that is also not working (only works using path not upload button) I tried the online solutions which mentioned file path and permissions, but they seem to be alright.
sudo chgrp www-data /var/www/html/teak-w ..read more
Stack Exchange - Drupal Answers
1d ago
Is it possible to set a different admin theme by user ?
I found this old module https://www.drupal.org/project/tbr it's probably possible to convert it to fit the new Drupal 8/10 system (https://www.drupal.org/node/2158619)
Does a solution already exist ..read more
Stack Exchange - Drupal Answers
1d ago
id: migrate_paragraphs
label: Migrate Paragraphs
migration_group: my_migration_group
source:
plugin: csv
path: 'modules/custom/migrated_content/importfiles/migrate_paragraph.csv'
delimiter: ","
header_offset: 0
ids:
- id
process:
type:
plugin: default_value
default_value: _wysiwyg_text
field_rich_text: body
# Add other field mappings as necessary
destination:
plugin: 'entity_reference_revisions:paragraph'
id: migrate_nested_paragraphs
label: Migrate Nested Paragraphs
migration_group: my_migration_group
source:
# Reuse the same source configuration from migr ..read more
Stack Exchange - Drupal Answers
1d ago
how can I access to my user role thanks to my user custom field ?
I have an user field called "custField" and it's value (example : 123456). I need to check all users that have "123456" as value.
Then, I need to check if this user as the role "director".
But I don't know how to access role thanks to another field.
EDIT :
See this loop :
foreach($retraitDoublons as $valUnique){
$users = \Drupal::entityTypeManager()->getStorage('user')
->loadByProperties(['field_custVal' => $valUnique]);
$user = reset($users);
$user_has_role = $user && $user->hasRole('directeur_cr_ ..read more
Stack Exchange - Drupal Answers
4d ago
I'm creating custom entities extending ContentEntityBase but when I review the created table in MySQL, it has created indexes from fields I don't want. This is and excerpt of my custom entity:
/**
* {@inheritdoc}
*/
public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
$fields = parent::baseFieldDefinitions($entity_type);
$fields['id'] = BaseFieldDefinition::create('integer')
->setLabel(t('ID'))
->setDescription(t('Id de la persona'))
->setReadOnly(TRUE);
$fields['uuid'] = BaseFieldDefinition::create('uuid ..read more
Stack Exchange - Drupal Answers
4d ago
id: migrate_paragraphs
label: Migrate Paragraphs
migration_group: my_migration_group
source:
plugin: csv
path: 'modules/custom/migrated_content/importfiles/migrate_paragraph.csv'
delimiter: ","
header_offset: 0
ids:
- id
process:
type:
plugin: default_value
default_value: _wysiwyg_text
field_rich_text: body
# Add other field mappings as necessary
destination:
plugin: 'entity_reference_revisions:paragraph'
id: migrate_nested_paragraphs
label: Migrate Nested Paragraphs
migration_group: my_migration_group
source:
# Reuse the same source configuration from migr ..read more
Stack Exchange - Drupal Answers
4d ago
I tried breaking things into 2 migrations were the first migration imports nodes from a CSV file and the second migration creates a group relationship.
group_content_migration.yml:
id: custom_group_content
migration_group: custom_group_content
label: 'Group content migration'
source:
plugin: csv
path: modules/custom/custom_migrations/artifacts/node_import.csv
ids: [id]
process:
type:
plugin: default_value
default_value: agency-group_node-basic_page
gid:
plugin: default_value
default_value: [GID #]
entity_id:
plugin: migration_lookup
migration:
- node_ ..read more
Stack Exchange - Drupal Answers
4d ago
In Drupal 10.2.4 with Statistics core module installed and node view count activated, I want to see a table of the most viewed nodes like this:
node 1 | alias (if any) | 601 views
node 8 | alias (if any) | 253 views
node 16 | alias (if any) | 112 views
node 5 | alias (if any) | 91 views
node 80 | alias (if any) | 28 views
When I visit a node I normally see something like NUMBER OF views but I that's not what I am asking about here. What I do ask about here is a table, preferably of all nodes altogether with just adjacent number of views for each node. How to get that ..read more
Stack Exchange - Drupal Answers
4d ago
Hey guys i have a challenge on hands that i need to exchange some ideas with you.
I have a website where users, with the role company, will fill in an big multistep form that i've built with webform and after submission other users with role moderator can change the "status" like: waitlist, eligible, not eligible, etc
The page where moderators can change the status needs to be a different form. So i need to connect both forms in some way that i still don't know.
How do you guys think i should do this? I was trying to prevent custom development, but if needed i can do it.
Thanks in advance and ..read more