Last active
May 9, 2020 07:08
-
-
Save prasadshir/be232c55197c5011b074ea4efa1f416d to your computer and use it in GitHub Desktop.
D728 Task-01: Create a custom page
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Controller file for Lotus Drupal 8 module. | |
* Place this file in src/Controller folder inside the lotus module folder | |
**/ | |
namespace Drupal\lotus\Controller; | |
use Drupal\Core\Controller\ControllerBase; | |
class HelloController extends ControllerBase { | |
public function content() { | |
return array( | |
'#type' => 'markup', | |
'#markup' => $this->t('Welcome to my website!'), | |
); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Lotus | |
type: module | |
description: Lotus module for learning Drupal 8 from Drupal 7 experience | |
core: 8.x | |
package: Acquia Learning |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Ruting file for the Lotus module in Drupal 8. | |
# Add this to the root of the module folder, | |
# e.g. modules/custom/lotus/lotus.routing.yml | |
lotus.content: | |
path: '/hello' | |
defaults: | |
_controller: '\Drupal\lotus\Controller\HelloController::content' | |
_title: 'Hello Drupal!' | |
requirements: | |
_permission: 'access content' |
Thanks, I was looking for a way of doing it with Console. Keep up the good work!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@prasadshir any plans to add a section
How to generate using DrupalConsole
I am adding an snipped as example:
Generate module
Interactive mode
Inline mode