🇬🇧United Kingdom @mike-kelly

Account created on 13 October 2023, about 1 year ago
#

Recent comments

🇬🇧United Kingdom mike-kelly

The issue occurs when making a range widget: in bef_sliders.js this is the case where $inputs.length = 2. In that case the float values are not truncated.

🇬🇧United Kingdom mike-kelly

This wasn't working for me... the issue was that the truncation was not applied when using the current page title token in the breadcrumb.
See attached patch for fix.

🇬🇧United Kingdom mike-kelly

I got there in the end myself...

For future reference, I had to create a relationship (SQL join) of 'Content used by' the event field in Events Series. From there I added a contextual filter based on that relationship. I chose to make that a filter on ID of Content. So the query was being filtered on the ID of the Event Series containing Events. Contextual filter entries are basically where clauses in a SQL query.

I then exposed that filter as a drop-down box of Event Series names, using a function in the 'views_exposed_form_alter' hook, as the default option was a text entry box, which I didn't want:

// create a list of event series
$nids = \Drupal::entityQuery('node')
  ->accessCheck(FALSE)
  ->condition('type','event_series')->execute();
$nodes =  \Drupal\node\Entity\Node::loadMultiple($nids);

$options = ['all' => t('None')];
foreach ($nodes as $node) {
  $options[$node->id()] = $node->label();
}

$form['series'] = [
  '#title' => new TranslatableMarkup('Event series'),
  '#type' => 'select',
  '#options' => $options,
  '#size' => NULL,
  '#default_value' => 'all',
];

A final note: there is a very useful options in Views - Settings to show the sql query in the views preview.

🇬🇧United Kingdom mike-kelly

I updated DDEV to the most recent version and that seemed to fix it, but the issue occurred again. I just needed to add an additional datasource, so I edited the settings.local.php file via ssh and moved on. In short, no solution I'm afraid.

🇬🇧United Kingdom mike-kelly

I see that this issue is being addressed via changes to Drupal core.

However in the meantime, I was hoping for a workaround for use with Drupal 10. I created the test module shown at the top of this issue and the computed field became available in my Views. However, at the point of trying to add it to a View, I got the following error:

Error: Call to a member function getType() on null in Drupal\views\Plugin\views\field\EntityField->defineOptions() (line 375 of /var/www/html/web/core/modules/views/src/Plugin/views/field/EntityField.php).

Is this expected, or have I missed something? Do I have to wait until the changes above have been merged to Drupal core before I can use computed fields in Views?

🇬🇧United Kingdom mike-kelly

mike-kelly created an issue.

Production build 0.71.5 2024