I am trying to find a way of altering the output of a hook_field_insert. In my exact example, I'm trying to hook into the link_field_insert hook, in the Link module:

* Implements hook_field_insert().
function link_field_insert($entity_type, $entity, $field, $instance, $langcode, &$items) {
  foreach ($items as $delta => $value) {
    _link_process($items[$delta], $delta, $field, $entity);

and make a modification to the _link_process function, without actually having to hack the Link module. Is thi possible?

Just to have some background, what my end goal is to add a new form field on the node page for the user to enter link classes, and these classes would be autmatically applied to the link. I have already overridden the theme_link_field to add this form field and its value shows up in the $items array in the above function, so I just need to know how to override the above function.

1 Answer 1


you don't need to alter the hook. You can implement the hook. But in your case maybe you want to use theme_menu_link() instead Customizing menu link output

also check https://api.drupal.org/comment/55298#comment-55298


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.