Updated: Comment #N

Problem/Motivation

There were many Drupal 7 Core hooks that were removed in Drupal 8. A module maintainer (contrib or custom) who needs to port a Drupal 7 module that used the hook to Drupal 8 is supposed to be able to go to
https://drupal.org/list-changes
and search to find information about how to port the module. This only works if a change notice has been written that includes the hook name in the body of the page, so that it can be searched on. [It also only works if that change notice includes examples that are useful, but this issue does not address that.]

The problem is that we have some hooks that were removed in Drupal 8 that do not have searchable change notices present. This is a critical problem for module maintainers, because they will not be able to easily discover how to port their modules.

Proposed resolution

a) Make a list of Drupal 7 hooks that are no longer present in Drupal 8, and for which you cannot go to https://drupal.org/list-changes and search by the hook name to find information. To do this:
- Visit https://api.drupal.org/api/drupal/includes!module.inc/group/hooks/7 (list of hooks in D7)
- Click through each one and see if at the top of the page, there is a Drupal 8 hook.
- If not, go to https://drupal.org/list-changes and search for the hook name.
- If there are no results, add the hook to the list of undocumented changes below.
This is done, see list below

[Note: for purposes of this issue, we'll assume that hooks that are no longer invoked in Core have been removed from their .api.php files and therefore are no longer listed on api.drupal.org. Hopefully!]

b) File issues for each hook or logical grouping of hooks, using this issue as parent.

c) When all the sub-issues have been resolved by updating existing change notices so they include the hook names, or creating new change notices, this issue can be marked fixed.

List of hooks missing change notices

Actions

hook_actions_delete Issue: #2201753: Fix up docs for entity operations hooks and add missing ones
hook_action_info_alter

Date formats

hook_date_formats_alter and related hooks: issue #2196557: hook_date_formats_alter() and related hooks removed, no searchable change notice!

Filter

hook_filter_format_insert Issue: #2201753: Fix up docs for entity operations hooks and add missing ones

Image styles

hook_image_style_delete Issue: #2201753: Fix up docs for entity operations hooks and add missing ones
hook_image_style_save Issue: #2201753: Fix up docs for entity operations hooks and add missing ones

Remaining tasks

a) Complete the list. DONE.
b) File issues for each hook or group of hooks.
c) Fix all the issues.
d) Mark this issue as fixed.

User interface changes

None.

API changes

None.

Comments

jhodgdon’s picture

Issue summary: View changes

Finished making the list of hooks that are missing without searchable change notices.

catch’s picture

Overlay, dashboard, trigger and OpenID modules were all removed from core, those hooks don't need mentioning in a change notice since they'll either exist in the contrib module with no change, or have a change notice in the contrib project.

I added hook_registry_files_alter() to https://drupal.org/node/1320394

sutharsan’s picture

All field_storage_* hooks got removed in #1497374: Switch from Field-based storage to Entity-based storage. The corresponding change notice is: https://drupal.org/node/2078765. I have no time left to create the issue to update this change notice.

jhodgdon’s picture

Issue summary: View changes

Thanks! I just updated the field storage change notice to list the removed hooks, so I think we don't need an issue.

And I updated the issue summary for comment #2.

jhodgdon’s picture

Issue summary: View changes

one more #2 update.

catch’s picture

Node not-really-hooks now all mentioned in https://drupal.org/node/2029519

jhodgdon’s picture

Issue summary: View changes

Thanks!

As you do things like that, updating the summary would be useful. :) I took care of the summary for #6.

tim.plunkett’s picture

hook_action_info_alter is still invoked in core, not sure why we removed the docs.

hook_actions_delete
hook_filter_format_insert
hook_image_style_delete
hook_image_style_save
These are all still invoked, but are now hook_$entitytype_$operation()... I thought they were documented, but only hook_entity_$operation() are.

jhodgdon’s picture

RE #8, It seems like it might be useful to have in an api.php file somewhere, doc blocks something like:

/**
 * Respond to image style deletion.
 *
 * This is actually a special case of hook_ENTITY_TYPE_delete().
 */
function hook_image_style_delete() {}

Assuming hook_ENTITY_TYPE_delete() was documented somewhere, I think this would be good enough, and we could quibble about the wording. Then we could also greatly reduce the node, taxonomy, etc. hooks docs, assuming they are just working through the generic mechanism.

However, we do not currently have any documentation for the hook_$entity_type_$operation hooks except hook_ENTITY_TYPE_access in 8.x, as far as I can see. I'm assuming we would need to document each operation's hook separately, because it would have different arguments?

Guess maybe we should open a separate issue to discuss this?

tim.plunkett’s picture

I'm assuming we would need to document each operation's hook separately, because it would have different arguments?

Guess maybe we should open a separate issue to discuss this?

Yes and yes. +1 to a follow-up for those hooks.

jhodgdon’s picture

Issue summary: View changes

Created #2201753: Fix up docs for entity operations hooks and add missing ones and updated summary for affected hooks.

Tim: are actions actually entities now? I wasn't sure but you had listed that hook as an entity hook. If not that one needs to be updated in the summary.

tim.plunkett’s picture

Yep, configured actions are entities: https://drupal.org/node/2020549

berdir’s picture

I'm quite sure that we already have at least one issue open about improving entity hook documentation, most of that is now focused on node hooks (like the order of hook invocations) but it should really be documented for entity hooks.

jhodgdon’s picture

Let's discuss #13 on the other issue if you want and if you can find the referenced issue.

catch’s picture

Issue summary: View changes

Removed all the hooks that have change notices or didn't need one from the issue summary.

I don't think hook_menu_contextual_links_alter() has an 8.x equivalent, maybe just needs a short one to say it was removed and you can still use https://api.drupal.org/api/drupal/modules%21contextual%21contextual.api....

Updated https://drupal.org/node/1537256 for the queue hook.

hook_locale() added to https://drupal.org/node/1266462

Added links to the issues for node/user bulk operations - we could have a single change notice just to say those were removed and use Views instead.

Grouped the rest a bit.

catch’s picture

Category: Bug report » Task

Also, no functional bug here. The remaining hooks I don't think anyone's going to miss much, if someone happens to know where the field issues are that'd be handy, I wasn't able to immediately track the correct issues down.

catch’s picture

Issue summary: View changes
berdir’s picture

Added hook_field_attach_preprocess_alter() to https://drupal.org/node/2168285

catch’s picture

Issue summary: View changes
catch’s picture

Did all the field hooks - they all had change notices for the issues, just needed those specific hooks adding explicitly (mainly alters missed out).

catch’s picture

Issue summary: View changes

Contextual links here: https://drupal.org/node/2165243

catch’s picture

Issue summary: View changes
Status: Active » Fixed

I added hook_node/user_operations() to the existing change notice, as well as hook_action_info_alter().

That leaves only hooks that have their own dedicated issues, bumped the entity hooks to 'major', and tagged the date formats issue with 'missing change record' so it gets included in that listing - we already have a critical meta tracking those.

By the way to find where a hook was removed, git log -S the_hook_name is your friend.

That's all of them, moving to fixed!

Status: Fixed » Closed (fixed)

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