No result found message is not showing the type.

Created on 17 July 2024, 4 months ago

Problem/Motivation

When using the acquia_dam module in a view, the "no result found" message does not correctly display the type. This makes it difficult for users to understand the context of the missing content. In my specific context, the client wants to show the type of media in the "no result found" message to provide clearer feedback to users.

Steps to reproduce

  • Choose DAM from the "Select media source" from the dropdown.
  • Check the "no results" message when there are no items for a specific media type.

Proposed resolution

Update the AcquiaDamTextCustom plugin to handle different media types based on the view arguments. The client specifically wants to display the type of media in the "no result found" message. Here is the proposed code change:

...
$media_type = '';
// Check if the view arguments are set and determine the media type.
    if (isset($this->query->view->args[0])) {
      $view_args = $this->query->view->args[0];
      switch ($view_args) {
        case 'acquia_dam_documents_asset':
          $media_type = 'Document';
          break;
        case 'acquia_dam_image_asset':
          $media_type = 'Image';
          break;
        case 'acquia_dam_pdf_asset':
          $media_type = 'PDF';
          break;
        case 'acquia_dam_spinset_asset':
          $media_type = 'Spinset';
          break;
        case 'acquia_dam_video_asset':
          $media_type = 'Video';
          break;
      }
    }
...
// Return the appropriate message based on the obtained values.
    if ($media_type !== '') {
      return ['#markup' => "No result found for $media_type."];
    }

Additional information:

  • Drupal version: 10.2.3
  • Module version: 1.0.13
  • PHP version: 8.1.29

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Active

Version

1.0

Component

Code

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024