I looked at similar questions on StackExchange and on these forums, but the selected answers didn't work for me. That is why I'm asking this question.
I have been following this tutorial to create my own custom Dupral 8 module. From what I can tell, I have the right file stucture and correct content in my files, but I get a page not found error. I have tried using leading slahes on the _controller in the photoshelter.routing.yml file and in the namespace declarations in the PhotoController.php file, but that hasn't changed anything. I have run out of ideas to try. Does anyone have any trouble shooting suggestions of spot errors in these files?
PhotoController.php
namespace Drupal\photoshelter\Controller;
use Drupal\Core\Controller\ControllerBase;
class PhotoController extends ControllerBase {
public function content() {
return array(
'#type' => 'markup',
'#markup' => $this->t('Hello, World!'),
);
}
}
photoshelter.info.yml
name: PhotoShelter API
description: Integrate the PhotoShelter API with your Drupal site.
package: Custom
type: module
core: 8.x
configure: photoshelter.settings
php: 5.6
photoshelter.routing.yml
photoshelter.content:
path: '/photoshelter'
defaults:
_controller: '\Drupal\photoshelter\Controller\PhotoController::content'
_title: 'PhotoShelter API'
requirements:
_permission: 'access content'
File Structure
photoshelter
-src
-Controller
PhotoController.php
info/routing.yml files