Drupal StackExchange

Views Bulk Operations skip confirmation

5 days 8 hours ago

I have defined a custom action for a VBO.

function expense_action_info() { return [ 'expense_finalize_action' => [ 'type' => 'node', 'label' => t('Approve and finalize expense'), 'behavior' => ['changes_property'], 'configurable' => TRUE, 'vbo_configurable' => FALSE, 'aggregate' => FALSE, ], ]; }

I've also created a configuration form for this action and rendered it along with the view.

function expense_finalize_action_form($settings, &$form_state) { $form['kickback_note'] = [ '#type' => 'textfield', '#default_value' => 'new' ]; return $form; } function expense_finalize_action_submit($form, $form_state) { return ['kickback_note' => $form_state['values']['kickback_note']]; }

When I submit the VBO I've redirected to page of this custom form and I need to click on the Next button to proceed the action. As I have provided required values in the form I need to skip this step. Is it possible?

Pramod Sivadas

CKEditor Inline Styles Getting Removed on save

5 days 9 hours ago

I am trying to edit the font size for CKEditor, however whenever I save these changes, the inline styles are removed.

Now I saw that it may be due to a custom Javascript configuration issue, and so I've put this in the Advanced Options dropdown:

config.allowedContent = true;

Even after putting this on both full and filtered, I've had absolutely no luck getting my inline styles to stay correct. What am I doing wrong? Is this a CKEditor problem, or a Drupal problem?

Nevermind, this is only happening on filtered. So I'm pretty sure it's just a Drupal setting in how filtered is configured. I'll post the solution soon.

Jack Ryan

Set custom message on node create

5 days 9 hours ago

D9.5 I'm trying to set custom status message on node create, but dunno how to pass created node title. I use this code on form submit: Drupal::messenger()>addMessage('message');

What a right way to get node title in system message (like default message)?

Otto Matik

Making custom database text fields available for search

5 days 9 hours ago

I have a custom module that stores text records in a table, however this table records are not mapped to nor an entity neither a node, so as far as I know, I can't expose them to the search module or the search API.

So my question is how do I expose my data (custom table fields) to Drupal so I can use some sort of search module (preferably search API or the core search) ?.

drcelus

Adding fields, account registrations and editing profile

5 days 10 hours ago

By default Drupal has a profile system in place that stores user name, password and email.

Profile2 extends this to allow specific roles upon account creation as well as more options for adding fields.

The problem is there are now two sections for adding fields, two tabs for editing account info, and no way to separate account editing into unique sections, or combine everything onto one edit page.

How can I have fields be on specific edit forms separated by how I feel they should be categorized.

Example: On user page there is an edit tab in user menu. when clicked there is a sub menu that has inks to specific edit forms: 1. edit profile 2. security info (password, phone number) 3. photos and media 4. Address 5. personal info 6. social networks

Why I asked the question: I sat down to add fields to the users pages, such as first name, last name and zip code and was very confuse where I should create these fields and which edit form they should live, the profile2 edit form or the core edit form.

Anon Ymous

Create an SVG using data from Views

5 days 11 hours ago

I am looking for a way to create a dynamically-generated SVG graphic based on data returned in a view from the Views module. Since Views creates lists and SVG is ultimately XML and therefore DOM-based, they seem perfectly well-suited to work together.

I have seen a few posts around saying that SVG support/integration in Drupal is very limited, and I have only ever seen Javascript used to create an SVG and then manipulate it's DOM. There are some popular javascript libraries already in use, such as Raphaël and svgweb.

Has anyone seen PHP used to do this as well? I have seen the SVG Embed module but it's very new, hasn't been updated since July, and almost nobody is using it.

Does anyone know of a better way to integrate SVG and Drupal Views?

diekunstderfuge

How to fix issue with scheduling Rules component evaluation [closed]

5 days 11 hours ago

I am trying to schedule a component for evaluation in Drupal 10

I routinely do this in Drupal 7. But in Drupal 10, the component is not being scheduled.

See steps taken below:

Rules module installed Rules Scheduler submodule enabled

Configured a component (type action) to send an email

Next step was to configure the Rule. Added event: After saving a new content item entity Added action: Schedule component evaluation (this involves providing the component key and scheduled evaluation time.

After the Rule is fired, and the Schedule tab is visited, the component is not found there.

seyi

Add cardinality_unlimited taxonomy reference to custom entity

5 days 12 hours ago

Okay, so I'm getting an error that I think may be a Views bug, but I don't have enough knowledge about Views & SQL right now to be sure about that.

Here's the hook I'm using to install the new field into the poll entity, using drush entity-updates:

/** * Implements hook_entity_base_field_info(). */ function mymodule_entity_base_field_info(EntityTypeInterface $entity_type) { if ($entity_type->id() === 'poll') { $fields['cat'] = BaseFieldDefinition::create('entity_reference') ->setLabel(t('Category')) ->setDescription(t('Category of poll')) ->setSetting('target_type', 'taxonomy_term') ->setCardinality(FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED) ->setDisplayOptions('form', array( 'type' => 'entity_reference_autocomplete', 'weight' => -10, 'settings' => array( 'match_operator' => 'CONTAINS', 'size' => '60', 'autocomplete_type' => 'tags', 'placeholder' => '', ), )) ->setTranslatable(TRUE); return $fields; } }

Then, I make a view that would like to use this taxonomy term as a Contextual Filter. I want to use the taxonomy term name rather than the ID, so I need to add a relationship. I add relationship in the view and look for the Taxonomy Term relationship that has my description, "Category of poll" and select it. The view complains about a SQL error:

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'poll__cat.cat' in 'on clause': SELECT poll_field_data.id AS id, taxonomy_term_field_data_poll__cat.tid AS taxonomy_term_field_data_poll__cat_tid FROM {poll_field_data} poll_field_data LEFT JOIN {poll__cat} poll__cat ON poll_field_data.id = poll__cat.entity_id AND poll__cat.deleted = :views_join_condition_0 LEFT JOIN {taxonomy_term_field_data} taxonomy_term_field_data_poll__cat ON poll__cat.cat = taxonomy_term_field_data_poll__cat.tid LIMIT 5 OFFSET 0; Array ( [:views_join_condition_0] => 0 )

The reason for the error in the above query is that the poll__cat.cat column does not exist, but it rather SHOULD be poll__cat.cat_target_id.

My question is: is this a views bug or a bug with the way I'm adding the field to the poll entity, and if it is a views bug:

  1. How do I debug it? Where does views set the column name it's looking for?

  2. Is there a hook I can use to change it, and/or should I submit this odd case to the views project?

EDIT: I'm trying to use hook_views_query_alter and hook_views_pre_execute to try and modify the broken query to do what I want it to do, but it is incredibly frustrating, because all of the things are protected, and it is very inconvenient to access anything, considering the purpose of these hooks is to modify data. I'm trying to look through the functions for ViewExecutable and the views Sql class, but I don't see anything that will help me change the column to what it should be! Anyone who can help in any way, I will be so grateful.

Edit 2: It seems like this guy: Views doesn't like multiple entity references in my entity has had a similar problem. I feel like this is a bug somewhere, or at the very least an issue with CARDINALITY_UNLIMITED being confusing to implement with entity references.

RaisinBranCrunch

Acquia Status

Acquia has detected an interruption of service for Acquia Customer Data Platform (CDP) AWS US PROD tenants

5 days 8 hours ago

May 1, 13:47 UTC
Resolved - The underlying cause of this service interruption has been addressed and all affected services have been restored. All services are operational at this time.

May 1, 08:57 UTC
Identified - We are currently experiencing some resource contention issue for a section of tenants hosted on AWS. This is affecting the clients hosted on AWS for Acquia Customer Data Platform(CDP). Customers using hub2.agilone.com would be affected by this and some of the jobs like campaigns/reports jobs are delayed for these tenants hosted on AWS. Our team already identified the root cause and fixing it.