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.
When adding new custom content to a panel pane, you are given the option to "Use context keywords" allowing token-like replacement of keywords with context values. I found it useful in a recent project to allow this for FPP as well. Patch forthcoming.
Comment | File | Size | Author |
---|---|---|---|
#29 | allow-context-substitutions.patch | 5.13 KB | firestonej |
#28 | FPP_Context_substitutions-2018329-28.patch | 5.13 KB | czigor |
#28 | interdiff-23-28.txt | 1.49 KB | czigor |
#14 | 2018329-14-FPP_Context_substitutions.patch | 5.77 KB | brunodbo |
#13 | 2018329-13-FPP_context_substitutions.patch | 6.36 KB | mikeker |
Comments
Comment #1
mikeker CreditAttribution: mikeker commentedComment #2
mikeker CreditAttribution: mikeker commentedFixes undefined index error when adding FPPs in a non-context situation (eg: admin/structure/fieldable-panels-panes/manage/fieldable-panels-pane/add).
Comment #3
bjalford CreditAttribution: bjalford commentedI can now see the checkbox but it doesn't save the value when selected. Going back into the pane and it's unchecked
Comment #4
mikeker CreditAttribution: mikeker commented@bjalford, Did you run update.php (or drush updatedb)? This patch introduces a DB schema change to save the settings.
Comment #5
barraponto CreditAttribution: barraponto commentedI get empty contexts even though there is a context in my panel :/
Warning: Invalid argument supplied for foreach() in ctools_context_keyword_substitute() (line 639 of DRUPAL/profiles/quequere/modules/contrib/ctools/includes/context.inc).
btw, I also get issues for fields that are not text-type, I've fixed with a !empty check.
Comment #6
merlinofchaos CreditAttribution: merlinofchaos commentedThe reason for the empty contexts is that a content type only receives requested contexts unless it sets 'all contexts' => TRUE in its definition. Then it will always receive all contexts. Since FPP shouldn't be requesting contexts that I can think of, this should be fairly safe to set.
Comment #7
barraponto CreditAttribution: barraponto commented@merlinofchaos actually,
'all contexts' => TRUE
is set: http://drupalcode.org/project/fieldable_panels_panes.git/blob/refs/heads... :/Right now I'm monkeypatching ctools to call
fieldable_panels_panes_fieldable_panels_pane_content_type_content_type
when needed (inctools_content_select_context
because calling it inctools_content_select_context
always led to out-of-memory errors).Comment #8
barraponto CreditAttribution: barraponto commentedI figured the
'content type'
key in plugin definition was missing (not sure if this is the proper way to declare it though). Then I found out thatfieldable_panels_panes_fieldable_panels_pane_content_type_content_type
andfieldable_panels_panes_load_entity
would call each other in a loop, so I fixed it by taking a shortcut to_fieldable_panels_panes_load_entity
.Now the contexts are passed to the pane and everything works. I've fixed a small issue with fields that don't set the
#markup
property, such as link fields.Comment #9
barraponto CreditAttribution: barraponto commentedComment #10
barraponto CreditAttribution: barraponto commentedAdded support for title links as well.
Comment #13
mikeker CreditAttribution: mikeker commentedRerolled #10 against the latest -dev.
Also made some adjustments to how title substitutions work as that code has evolved (title now shows as a child element in addition to
$block->title
...?).Comment #14
brunodboReroll of #13 against latest dev.
Comment #16
chandimac CreditAttribution: chandimac commentedWorks great for text fields. Is there a way to get this to work for image fields as well? I'm using the Media module and there is no way to add a token substitution through the UI.
Comment #17
B-Prod CreditAttribution: B-Prod commentedLast patch works as expected.
Comment #18
brunodboRerolled patch in #14 against latest dev.
Comment #19
DamienMcKennaThis needs some tests to confirm it works. Also, this line needs to be rewritten to not have the word "you" and make the URL a link:
+ $description = t('If checked, context keywords will be substituted in this content. More keywords will be available if you install the Token module, see http://drupal.org/project/token.');
Comment #20
thePanz CreditAttribution: thePanz at Liip for FREITAG lab. AG commentedRe-rolled patch, with fixes as outlined by DamienMcKenna.
Comment #21
dpacassiI have re-rolled the patch mentioned in #20 as FPP has meanwhile declared additional update hooks.
Comment #23
dpacassiWell, that was a hot shot, didn't expect so many changes inside FPP.
Here's the updated patch.
Comment #24
thePanz CreditAttribution: thePanz at Liip for FREITAG lab. AG commentedMoving to "Need review" to let DrupalBot pick this patch for testing.
Comment #25
B-Prod CreditAttribution: B-Prod commentedThis patch is a reroll of #23 against current DEV and takes care of the entity "path", that may need substitution.
Comment #26
DamienMcKennaNeeds tests.
Comment #27
wizonesolutionsHiding old files. Might try to fix this up. @DamienMcKenna, do you know what tests are needed at a glance?
Comment #28
czigor CreditAttribution: czigor at Liip for FREITAG lab. AG commentedPatch did not work on new FPP version, needed to rename hook_update_N().
Comment #29
firestonej CreditAttribution: firestonej as a volunteer commentedFresh patch for dev / 7.x-1.13.