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.
Problem/Motivation
Currently, it is not possible to alter the $content_type array generated by the CTools content type in fieldable_panels_panes_fieldable_panels_pane_content_type(). A site builder may desire to alter this array for a number of reasons. For example, a site builder may wish to display a particular revision of a reusuable FPP.
Proposed resolution
Add a hook_fieldable_panels_panes_fieldable_panels_pane_content_type_alter() function:
// If there's only 1 and we somehow have the wrong subtype ID, do not
// care. Return the proper subtype anyway.
if (empty($content_type) && !empty($plugin['single'])) {
$content_type = current($subtypes);
}
}
+ drupal_alter('fieldable_panels_panes_fieldable_panels_pane_content_type', $content_type, $subtype_id, $plugin);
+
return $content_type;
}
/**
* Callback to return the custom content types with the specified $subtype_name.
Remaining tasks
None
User interface changes
None
API changes
Add note in release about new hook_fieldable_panels_panes_fieldable_panels_pane_content_type_alter() function.
Data model changes
None
Comment | File | Size | Author |
---|---|---|---|
#7 | fieldable_panels_panes-n2865462-7.patch | 2.22 KB | DamienMcKenna |
|
Comments
Comment #2
Chris Burge CreditAttribution: Chris Burge commentedComment #3
DamienMcKennaInteresting change. This needs some documentation before it can be committed.
Comment #4
Chris Burge CreditAttribution: Chris Burge commentedComment #5
Chris Burge CreditAttribution: Chris Burge commentedComment #6
Chris Burge CreditAttribution: Chris Burge commentedForgot the "_alter" at the end of the function name in the api documentation.
Comment #7
DamienMcKennaShortened the hook name.
Comment #8
DamienMcKennaComment #10
DamienMcKennaCommitted.