I get the following error on Drupal's core status page after enabling Salesforce. The status page then stops rendering at "Salesforce Provider Status" throwing this error.
(1/1) ContextErrorException
User Error: Symfony\Component\Debug\Exception\ContextErrorException thrown while calling __toString on a Drupal\Core\StringTranslation\TranslatableMarkup object in /Users/norman/Sites/ix-eu-multisite/web/core/lib/Drupal/Component/Utility/Html.php on line 424: Warning: htmlspecialchars() expects parameter 1 to be string, object given
Looking into salesforce.install it seems that there are URL-objects passed to t(). Uncommenting them quick-fixes the issue. Trying to make them a string by appending ->toString() gives me a fatal saying that these routes don't exist. This currently happens on 8.3.4, 8.3.x-dev and 8.4.x-dev.
t('No auth providers have been created. Please <a href="@href">create an auth provider</a> to connect to Salesforce.', ['@href' => Url::fromRoute('entity.salesforce_auth.add_form')])
See https://git.drupalcode.org/project/salesforce/blob/8.x-3.4/salesforce.in...
t('Salesforce authentication failed. Please <a href="@href">check your auth provider settings</a> to connect to Salesforce.', ['@href' => Url::fromRoute('entity.salesforce_auth.edit_form', ['salesforce_auth' => $authMan->getConfig()])])
See https://git.drupalcode.org/project/salesforce/blob/8.x-3.4/salesforce.in...
I'd provide a patch, but I'm new to this module and don't know what exactly is supposed to be linked here.
Comments
Comment #2
norman.lolComment #3
aaronbaumanThis has broken too many times, and I'm sick of re-fixing it, so I created some tests.
Attached are failing tests for 4.x.
After fixing for 4.x, similar concept should be applied for 3.x
Comment #4
norman.lolThat's a good idea! Can you maybe help me Aaron to kickstart understand why these routes are reported as non-existing when I
->toString()them? Maybe I can jump in then and provide a patch as well.Comment #5
aaronbaumanFixed syntax problem in test.
The patch that addresses the tests will look like this.
Note: in the 2nd change here, i've had to add not just
->toString()but also->id(), becaues the URL generator refuses to translate an entity into a route argument. This is likely where your change was failing.Comment #6
aaronbaumanOk, let's try again.
Test wasn't run due to incorrect namespace.
Comment #8
aaronbaumanSame tests plus fix.
Comment #10
aaronbaumanCommitted on 4.x
Patch does not apply cleanly on 3.x - do you want to take a crack at it?
Comment #11
norman.lolYupp, I'll try to make the patch work with 3.x-dev now.
Comment #12
norman.lolHummm, I got stuck pretty fast.
Since in 3.x there's no such route
entity.salesforce_auth.add_formdefined insalesforce.routing.yml. The routing pattern also seems to have changed a bit from 3.x to 4.x. Adding this route as follows, brings me back tosrc/Entity/SalesforceAuthConfig.phpwhich also has no add-form defined, and the default one gives me an error of entity type does not exist.Are you sure that the requirements not accidentally got mixed up from 4.x into 3.x somehow and now are breaking the 3.x logic?
Comment #13
aaronbaumanIn 3.x, the top-level auth route is the single auth form.
It's a a single, argument-free route you can point to:
salesforce.authorizeNB: The pluggable auth architecture exists in 3.x, but only for forwards-compatibility to help ease the upgrade path to 4.x.
3.x is not meant to have the same config form UI as 4.x
Comment #14
norman.lolOooookay, following your lead I diffed this now on the 3.x branch.
Comment #15
norman.lolFixed severity.
Comment #16
norman.lolComment #18
aaronbaumanCommitted - thanks for the patch!