Call to a member function label() on null

Created on 19 May 2020, over 4 years ago
Updated 14 March 2024, 9 months ago

Error: Call to a member function label() on null in Drupal\access_unpublished\AccessTokenListBuilder->buildRow() (line 100 of modules/contrib/access_unpublished/src/AccessTokenListBuilder.php).

occurs if trying to edit a translation that hasn't been translated yet, ex, es/node/edit of a node that only has a default language of another language version.

I'm also using other patches for making access_unpublished work better with content translation.

see patch

πŸ› Bug report
Status

Needs review

Version

1.0

Component

Code

Created by

πŸ‡¨πŸ‡¦Canada joseph.olstad

Live updates comments and jobs are added and updated live.
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.

  • πŸ‡ΊπŸ‡ΈUnited States dave reid Nebraska USA

    Should access tokens automatically get deleted when the host entity is deleted? Maybe we're missing that link?

  • πŸ‡ΊπŸ‡ΈUnited States dave reid Nebraska USA

    I would probably prefer to see "Deleted" instead of nothing.

  • Issue was unassigned.
  • πŸ‡ΊπŸ‡ΈUnited States DamienMcKenna NH, USA
  • πŸ‡©πŸ‡ͺGermany IT-Cru Munich

    @Dave Reid: There is already a hook_entity_delete() implemented since 5 years in the module. So normally all access tokens should be deleted, when a host entity gets deleted.

    /**
     * Implements hook_entity_delete().
     */
    function access_unpublished_entity_delete(EntityInterface $entity) {
      /** @var \Drupal\access_unpublished\AccessTokenManager $tokenManager */
      $tokenManager = \Drupal::service('access_unpublished.access_token_manager');
      foreach ($tokenManager->getAccessTokensByEntity($entity) as $token) {
        $token->delete();
      }
    }
    
Production build 0.71.5 2024