The two entity view functions in fieldable_panels_panes.module have different arguments: in one the $langcode defaults to NULL, and in the other it doesn't. The code comments imply that they are supposed to be duplicates.
/**
* View a fieldable panel pane.
*
* @see node_view()
*/
function fieldable_panels_panes_view($entity, $view_mode = 'full', $langcode = NULL) {
return entity_get_controller('fieldable_panels_pane')->view($entity, $view_mode, $langcode);
}
/**
* Entity API callback to view a fieldable panel pane.
*
* This is essentially a duplicate of fieldable_panels_panes_view() but the
* function name has to match the entity type with is singular.
*
* @see entity_view()
*/
function fieldable_panels_pane_view($entity, $view_mode = 'full', $langcode) {
return entity_get_controller('fieldable_panels_pane')->view($entity, $view_mode, $langcode);
}
It seems like the langcode should be defaulted to NULL in both cases. If it isn't, and if code calling the 2nd function omits the langcode, it's going to start throwing an ArgumentCountError as of PHP 7.1.
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | fieldable_panels_panes-n2936307-3.interdiff.txt | 582 bytes | damienmckenna |
| #3 | fieldable_panels_panes-n2936307-3.patch | 985 bytes | damienmckenna |
Comments
Comment #2
cboyden commentedSee attached patch, which makes the 2nd version of the function default the langcode to NULL.
Comment #3
damienmckennaThat makes complete sense, thank you.
Lets make the code even more clear.
Comment #5
damienmckennaCommitted. Thanks!
Comment #7
liam morland