Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
There is the ability to use #skip_edit for field API fields, but how can I make it so that the node title is not editable via the edit module?
Comments
Comment #1
rooby CreditAttribution: rooby commentedAfter a little investigation I see I can override theme_edit_wrap_field() to not add the wrapper but that seems a bit hackish.
Maybe this should instead be a feature request.
When pseudo field are generated we have access to the entity type, entity id, field name, language, view mode, and bundle, so we could have a hook that gets called with that info and modules can return false to deny editing.
That's the first idea that springs to mind but there are a bunch of ways it could be done.
Comment #2
rooby CreditAttribution: rooby commentedComment #3
Wim LeersYou'll want to use
hook_edit_editor_metadata_alter()
to do that :) As you already say, there's no clear way to do this because titles aren't rendered using the Render API.You'll want to do something like this:
EXCEPT… that that hook is also called exclusively for non-extra fields. So I updated the invocation of that hook, added a little bit more context, and now the above exact code works: I tried it myself :)
http://drupalcode.org/project/edit.git/commit/afa601d
Comment #4
rooby CreditAttribution: rooby commentedGreat, thank you.
Comment #5
Wim LeersYou're welcome!