1

my code below results in a page not found when I browse to the path. How can I debug what is going wrong? I dont see any errors and I have cleared the cache.

mymodule.content:
  path: '/admin/viewfiles'
  defaults:
    _controller: '\Drupal\mymodule\Controller\FileView::content'
    _title: 'File Operations Module Description'
  requirements:
    _permission: 'access administration pages'
  • See Adding a basic controller. Did you create the src/Controller folders? Did you name your controller file FileView.php? Does your controller extend the ControllerBase class? Did you namespace your controller? – No Sssweat May 11 '17 at 21:51
  • Yes yes and yes . I did all that . If not I would get an error when running drush – Diana May 11 '17 at 23:29
  • So far everything looks good, @Diana can you post your controller's code? – No Sssweat May 11 '17 at 23:36
  • 2
    Is the routing file named correctly? – Kevin May 11 '17 at 23:50
  • Remove the initial backslash from the controller namespace + make sure the module is neabled + make sure you have cleared cache after making changes in routing file. – user21641 May 12 '17 at 6:57
1

thanks i had a misspelling in the router name. thank you all

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.