Adding a view argument to the callback signature

Created on 6 September 2018, almost 7 years ago
Updated 30 July 2025, 13 days ago

Depending on the use case we may use the extra_field in many views and it may brings us to need a different callback returns, depending on the view and the display.
So I think changing the callback signature to add the view object as a second argument will make us more flexible.

Below is an example of callback implementation

/**
 *
 */
function mymodule_extra_field_views_entity_callback( $entity, $view ) {
   switch( $view->name ) {
     case 'viewA':
       // handle view A 
       return handleviewA($entity);
     break;
    case 'viewB':
      // handle view B
      return handleviewB($entity);
     break;
   }
}
✨ Feature request
Status

Closed: outdated

Version

1.3

Component

Code

Created by

πŸ‡«πŸ‡·France ceonizm Marseille

Live updates comments and jobs are added and updated live.
  • API change

    Changes an existing API or subsystem. Not backportable to earlier major versions, unless absolutely required to fix a critical bug.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡¦Ukraine bohart Lutsk, Ukraine

    D7 reached its EOL back in January 2025, and there is no active release for D7 for this module anymore.
    Development or support is not planned for D7.

    All D7-related issues are marked as outdated in a bunch.
    Still, everyone can apply the patch above (not tested/reviewed by the maintainers) to their Π’7 projects.

    If the issue's topic is actual in D10+ versions, please create a follow-up issue or comment on this one (to re-open and switch to the 2.2.x development branch).
    Thanks!

Production build 0.71.5 2024