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.
Currently, admin_title is being used as the entity label, but this is a bit strange since that field doesn't even appear to the user unless they make the FPP reusable. It should probably be the title field instead, which always appears for the user.
In addition, the title field should be required, as some tools, like the entityreference browser )http://drupal.org/sandbox/davidseth/1489176), expect entity_label to return something non-empty, and it probably should always be non-empty.
Patch forthcoming.
Comment | File | Size | Author |
---|---|---|---|
#23 | fieldable_panels_panes-n1588882-23.patch | 1.18 KB | DamienMcKenna |
Comments
Comment #1
mcarbone CreditAttribution: mcarbone commentedComment #2
merlinofchaos CreditAttribution: merlinofchaos commentedThe admin title is specifically meant to possibly be different from the actual title of the content, because sometimes the visible title is different from how the content is identified. I am dubious about this change.
Comment #3
mcarbone CreditAttribution: mcarbone commentedHm, what do you suggest as a solution then to something like entityreference_browser that requires a label? It seems to me that if Administrative title is meant to be the identifying title everywhere (and not just when a pane is reusable) then that should be the required field instead, and should be moved out of the reusable fieldset.
Comment #4
Stalski CreditAttribution: Stalski commentedI am strongly in favor of how it is implemented right now. We had some different opinions internally about this ... but end conclusion is the way it is now.
Comment #5
mcarbone CreditAttribution: mcarbone commentedI am not quite sure what part you all are disagreeing with. The patch still allows a different title/admin title, it's just trying to resolve this issue:
Seems to me that at least one title field needs to be required -- whether it's title or admin_title I have no particular strong feeling toward.
Comment #6
merlinofchaos CreditAttribution: merlinofchaos commentedI suppose if admin_title is empty for non-reusable panes, we could always copy the title into that field? That would solve the problem?
Comment #7
merlinofchaos CreditAttribution: merlinofchaos commentedComment #8
mcarbone CreditAttribution: mcarbone commentedWell, that doesn't the solve problem because title itself is currently not required. In fact, currently no fields are required -- a completely empty FPP can be created.
So perhaps another approach would be to:
a) Make Title required and use it for entity_label (which is what the patch in #1 does); and
b) Make Admin Title required if "Reusable" is checked
If there's an argument to be made for keeping Title non-required, I don't think I'm following it.
Comment #9
merlinofchaos CreditAttribution: merlinofchaos commentedI often have needs for blocks with no titles.
Comment #10
mcarbone CreditAttribution: mcarbone commentedSure, which is why the core block module requires "Block description", its analog to "Administrative title" here. So then is the solution to move that field up and always require it (reusable or not), and to keep it as the entity_label?
And then admin/structure/panels/entity/manage/[bundle] could be modified to use Admin Title as the primary column rather than Title.
Comment #11
caschbre CreditAttribution: caschbre commentedWe're looking at entity reference and FPP for an upcoming project and this poses a potential issue. Here's what we were considering as a solution.
1) If admin title is populated then we should be good to go.
2) If admin title is missing and title is populated then populate admin title with title.
3) If admin title and title are missing then populate admin title with a pattern.
A possible pattern could be: fpp__ (or something along those lines).
This should satisfy always having a value in admin title but a) not requiring the instance to be marked re-usable to populate admin title; and b) not requiring an entity title.
While it may be odd to see fpp__ in an entity reference field, the user still has the option to fill out the title or admin title.
Comment #12
jlapp CreditAttribution: jlapp commentedBuilding off of caschbre's suggestion, what about using a callback function for the entity label rather than Admin Title or Title?
The callback function could use the logic caschbre suggested in #11, where the label would be the Admin Title if it is populated, otherwise it would be the title if it is populated, otherwise a unique label would be generated based on a pattern (fpp__[bundle]_[fpid]).
This allows Title and Admin Title to remain not-required, allows them to have different values if the user specifies them, and makes sure there is always a non-empty label for Entity Reference and other modules to display. It should not add any DB performance overhead since the $entity object is already fully loaded in the label callback.
I'm attaching a patch that implements the solution I described. Any feedback on the approach or implementation is certainly welcome.
Comment #13
merlinofchaos CreditAttribution: merlinofchaos commentedI like this patch very much.
Comment #14
merlinofchaos CreditAttribution: merlinofchaos commentedI think this just needs a quick test from someone such as mcarbone to ensure it solves the original problem adequately and it can be committed.
Comment #15
caschbre CreditAttribution: caschbre commentedGreat work Jameson! I'll sync up with you Monday so we can tackle those other Panelizer and ERS issues.
Comment #16
eloivaqueThe patch of #12 it's works.
Comment #18
jlapp CreditAttribution: jlapp commentedThanks for testing eloiv!
I see that the patch no longer applies cleanly to the 7.x-1.x-dev branch, so I've re-rolled it against the latest version. Hopefully this can be committed now.
Comment #19
nielsonm CreditAttribution: nielsonm commentedPatch #18 works for me. Thanks!
Comment #20
DamienMcKennaComment #21
DamienMcKennaPatch reroll so it'll work once #1618308, #2237137 and #2237097 are committed.
Comment #23
DamienMcKennaRerolled.
Comment #24
dsnopekPatch works great in my testing!
Comment #25
DamienMcKennaCommitted.