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

Error when overriding profile.tpl.php #35

Open
robertgarrigos opened this issue Aug 24, 2024 · 9 comments
Open

Error when overriding profile.tpl.php #35

robertgarrigos opened this issue Aug 24, 2024 · 9 comments

Comments

@robertgarrigos
Copy link
Member

Overwriting profile.tpl.php triggers an error:

Warning: Undefined array key "#entity" a template_preprocess_entity_plus() (línia 147 de /Users/robert/Sites/backdrop/modules/entity_plus/theme/entity_plus.theme.inc).
Error: Call to a member function label() on null a entity_label() (línia 774 de /Users/robert/Sites/backdrop/core/modules/entity/entity.module).

I found the same kind of error with paragraphs (backdrop-contrib/paragraphs#91) which has been fixed.

@argiepiano
Copy link
Contributor

argiepiano commented Aug 24, 2024

What do you mean by "overwriting"? Overriding?

Can you add more specific steps to reproduce? I believe you have Entity Plus enabled (which is not required for this module).

I do see some issues in profile.info.inc which is only used when E+ is enabled. For starters, it has the wrong callbacks: entity_property_verbatim_set and entity_property_getter_method, which don't exist. In Backdrop's Entity Plus, those should be entity_plus_property_verbatim_set and entity_plus_property_getter_method. So perhaps this is in part producing this problem (though I doubt it).

I see another issue, which may also be causing this problem: profile_entity_info() defines a 'label callback' => 'entity_class_label', which doesn't exist in Backdrop. It should probably be 'entity_label'.

If you want to try patching your site with those and seeing if that helps, that'd be helpful to pinpoint the problem.

@robertgarrigos
Copy link
Member Author

robertgarrigos commented Aug 25, 2024

Yes, overriding I meant. I need Entity Plus for some other module. Thanks, @argiepiano, those changes didn't fix the problem. Steps are easy, just create a profile and try to override profile.tpl.php file within your theme. Accessing the profile page triggers the error.

@argiepiano
Copy link
Contributor

Did you try clearing caches after the changes? If so, OK, that means that more debugging is needed.

@robertgarrigos
Copy link
Member Author

yep, cache was cleared.

@robertgarrigos
Copy link
Member Author

Commenting the function profile_entity_info_alter(&$entity_info) in profile.module fixes the error. I have been doing actions on profiles with no problem. Is that hook_entity_info_alter() function used at all?

@argiepiano
Copy link
Contributor

argiepiano commented Aug 25, 2024

Yes, it defines metadata for all of profile properties. You won't be able to use entity_metadata_wrapper with profile entities now. But this also points at the fact that the error is there. Most likely an inexistent callback, like I said above. You probably missed some of those.

To find the culprit, you should look at ALL callbacks specified there (as in setter callback , getter callback and others) and check that the callback function actually exists.

@argiepiano
Copy link
Contributor

Actually, what I just sald above is wrong. profile_entity_info_alter() does not provide metadata. It actually tells your site to use the controller provided by Entity Plus.

So, commenting that out will avoid using E+ entity controller for Profiles in your site. This is an acceptable solution in your case. But the bug needs to be found, since it still exists.

@robertgarrigos
Copy link
Member Author

I'm lost with this bug.

@argiepiano
Copy link
Contributor

If I had the time I'd try to reproduce ... not right now unfortunately.

@bugfolder bugfolder changed the title Error when overwriting profile.tpl.php Error when overriding profile.tpl.php Aug 25, 2024
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

No branches or pull requests

2 participants