apigee-edge-drupal
apigee-edge-drupal copied to clipboard
Error: Call to a member function isRouted() on string in apigee_kickstart_enhancement_preprocess_menu()
Description
After i installed apigee kickstart with composer and try to access configuration pages as admin user throw this exception.
Apigee Info
"apigee/apigee_devportal_kickstart": "^3", "drupal/core-composer-scaffold": "^10", "drupal/core-project-message": "^10", "drupal/core-recommended": "^10",
Steps to Reproduce
Actual Behavior
Error: Call to a member function isRouted() on string in apigee_kickstart_enhancement_preprocess_menu()
Expected Behavior
Portal open without any exceptions
Screenshots
If applicable, add screenshots to help explain your problem.
Notes
Add any other context about the problem here.
Version Info
apigee/apigee_devportal_kickstart : 3.0.4 drupal/core : 10.4.6
I tried this solution by add is_object($item['url']) for condition
/**
* Implements hook_preprocess().
*/
function apigee_kickstart_enhancement_preprocess_menu(&$variables) {
// Hide the registration link for authenticated users.
foreach ($variables['items'] as $key => &$item) {
if (is_object($item['url']) && $item['url']->isRouted() && $item['url']->getRouteName() === 'user.register' && \Drupal::currentUser()->isAuthenticated()) {
unset($variables['items'][$key]);
}
}
}
Hi @MahmoudSayed96 Thanks for creating the ticket and updating about this issue. Did the solution worked, which you mentioned above ?
Hi @kedarkhaire Yes, the issue was fixed after adding a condition to check the value of the URL.
Hi @MahmoudSayed96 Can you please create the PR for the same, we will review it. Thanks!
Hi @MahmoudSayed96 Are you still facing this issue ?