Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Entity Tokens throws warning if comments not enable #32

Closed
e0Re0R opened this issue Mar 11, 2022 · 4 comments · Fixed by #33
Closed

Entity Tokens throws warning if comments not enable #32

e0Re0R opened this issue Mar 11, 2022 · 4 comments · Fixed by #33

Comments

@e0Re0R
Copy link

e0Re0R commented Mar 11, 2022

Hi,
my site does not have comments enabled.
Installing (& enabling) Entity Tokens throws a warning in the status report -
"The following token types are not defined but have tokens:
$info['types']['comment']"

This only appears if comments and Entity Tokens is are both enabled.

Its not killing my site or anything, more just an FYI

N

@argiepiano
Copy link
Collaborator

Hi @e0Re0R . Thanks for reporting. This warning is thrown by Backdrop core when a token type is not defined. The module comment defines the token type comment, so it's very strange that this is shown if comment is enabled. Can you please go to admin/modules/list and double check that comment is indeed enabled? Also try clearing the caches.

Let me know also if you are using version 2.0.1 of Entity Token.

@argiepiano
Copy link
Collaborator

Hi again. The title of this issue is confusing. You say there that comments is not enabled, but the text of the issue seems to indicate that it is enabled. Can you please clarify?

@argiepiano
Copy link
Collaborator

OK, I think I understand now - I have been able to reproduce this error by disabling and uninstalling comment. I'll check why this is happening very soon.

@argiepiano
Copy link
Collaborator

Hi again. I have fixed that issue. You have a couple of choices

  • You can manually patch the file entity_token.tokens.inc by wrapping 46 through 61 as follows:
  // Tokens for type comment.
  if (module_exists('comment')) {
    $info['tokens']['comment']['subject'] = array(
      'name' => 'Subject',
      'description' => t('The subject of the comment.'),
      'entity-token' => TRUE,
    );
    $info['tokens']['comment']['status'] = array(
      'name' => 'Status',
      'description' => t('Whether the comment is published or unpublished.'),
      'entity-token' => TRUE,
    );
    $info['tokens']['comment']['comment_body'] = array(
      'name' => 'Comment',
      'description' => t('Field "comment_body". The following properties may be appended to the token: value (Text), format (Text format)'),
      'entity-token' => TRUE,
    );
  }
  • You can download the dev version with the patch I'm about to merge
  • You can wait until the next release (maybe a couple of weeks)

This warning will not cause any issues, though.

Thanks again for reporting!!!

argiepiano added a commit that referenced this issue Mar 11, 2022
Issue #32. Check if comment is enabled
argiepiano added a commit to argiepiano/entity_token that referenced this issue Jun 5, 2022
argiepiano added a commit that referenced this issue Jun 5, 2022
Issue #32. Skip creation of tokens if entity doesn't have properties
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants