No "Expression" field in Sort Criteria

Created on 9 May 2024, 7 months ago
Updated 23 May 2024, 7 months ago

I am probably doing something wrong or missing something. But I've looked everywhere in my Views and View Settings and I don't see an "Expression" textarea field that you can add to the Sort Criteria. Using the 2.0 version of the module and Drupal 10.2.4. Attached a screen shot of the Sort Criteria searching for "Expression" and nothing comes up, I have also scrolled through it manually a bunch of times. Maybe adding some kind of documentation to the module page or some screenshots would be helpful. Maybe I'm missing something but some direction would be appreciated. Thanks.

πŸ› Bug report
Status

Fixed

Version

2.0

Component

User interface

Created by

πŸ‡ΊπŸ‡ΈUnited States Kurt.j

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

Comments & Activities

  • Issue created by @Kurt.j
  • πŸ‡ΊπŸ‡ΈUnited States Kurt.j

    I compared the 2.0 version with 8.x-1.2 version and found that a critical function is missing:

    /**
    * Implements hook_views_data_alter().
    *
    * Alter the table and field information from hook_views_data().
    *
    * @param array $data
    * An array of all information about Views tables and fields, collected from
    * hook_views_data(), passed by reference.
    *
    * @see hook_views_data()
    */
    function views_sort_expression_views_data_alter(array &$data) {
    $data['views']['views_sort_expression'] = [
    'title' => t('Expression'),
    'help' => t('Allow you to use an SQL expression.'),
    'sort' => [
    'id' => 'views_sort_expression',
    ],
    ];
    }

    The above was deleted from the .module file for some reason. You may want to put that back in and push it out ASAP. With out it the Expression field never lands in the the Sort Criteria making this module do nothing really.

    • hanoii β†’ committed c081a9ab on 2.x
      revert: Issue #3446307: No "Expression" field in Sort Criteria'
      
      Partial...
  • Status changed to Fixed 7 months ago
  • πŸ‡¦πŸ‡·Argentina hanoii πŸ‡¦πŸ‡·UTC-3

    Thanks! For some reason I thought that hook was not needed anymore and the sort plugin was discovered on its own. I even searched for it, but something must I obviously missed something. Apologies, 2.0.1 is out!

  • πŸ‡ΊπŸ‡ΈUnited States Kurt.j

    Thanks Dude for the speedy response! I appreciate it!

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024