Problem/Motivation
There are a number of problems with the Recent leads block:
- On install and setup of this module, the Canvas component library breaks because the block fails to load with a 403 error, because a required scope is not configured (
crm.objects.contacts.read) - On fixing that, the component is still broken on render issues
- Adding this block to any page, you can see the error:
TypeError: Drupal\Component\Utility\Html::escape(): Argument #1 ($text) must be of type string, null given, called in /var/www/html/web/core/lib/Drupal/Component/Render/FormattableMarkup.php on line 238 in Drupal\Component\Utility\Html::escape() (line 433 of core/lib/Drupal/Component/Utility/Html.php).
Debugging this I was able to eventually get it to load by updating the code to match the current response, but the $lead['profile-url'] no longer exists per this thread.
We could instead construct the URL with the portal id and contact vid but that feels kind of fragile?
Without the URL I'm not really sure of the value of this block, I would propose removing it from 3.x.
Steps to reproduce
Install the module and set it up with an app containing the default recommended scopes
- Try to load a Canvas page
- Fix the scopes, then try adding the block to any page
- See there is a WSOD
Proposed resolution
Remove this block altogether, otherwise, update it for the current API? If there is a desire to keep it, I can create an MR with the changes.
Remaining tasks
TBC
User interface changes
TBC
API changes
N/A
Data model changes
N/A
Issue fork hubspot-3567169
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
pameeela commentedCreated a draft MR just so I didn't lose the changes :)
Comment #5
richgerdesHey @pameeela, the changes look pretty good. I think constructing the url makes sense. Its not ideal, but i think its a quick and easy option. If the url ever changes, we can consider trying to fetch the contact record over the api and using its' url property if you want to do that. I think either option is good as I don't expect hubspot to change this implementation any time soon.