Entity binding in PHP code
-
Am attempting to use data from 365 to override the title and meta description fields for our SEO plugin.
The page is called product-detail and I have it bound to the Product entity from 365.
I am using this from the documentation to create the WordPress filter in functions.php — have copy/pasted and just changed to the fields I need:
add_filter( ‘wordpresscrm_data_binding_columns’, function( $fields, $postContent, $postId ) {
return array_merge(
$fields,
[ ‘productid’, ‘productnumber’, ‘name’, ‘description’, ‘oea_subject’ ] );
}, 10, 3 );When referencing the entity binding line in my child theme template file:
$currentRecord = ACRM()->binding->getEntity();
It throws an error:
Fatal error: Uncaught Error: Call to a member function getEntity() on null in /home/beta7327/public_html/wp-content/themes/vantage-child/functions.php
Do I need to pass something into that getEntity function like the guid?
Thank you for the assistance.
Joe
- The topic ‘Entity binding in PHP code’ is closed to new replies.