Skip to content

Instantly share code, notes, and snippets.

@gargsuchi
Created April 10, 2017 06:07
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save gargsuchi/f1e7276f26c7d152f74b295ca586df73 to your computer and use it in GitHub Desktop.
Save gargsuchi/f1e7276f26c7d152f74b295ca586df73 to your computer and use it in GitHub Desktop.
name: Lotus
type: module
description: Lotus module - Task-02 Create a custom page with arguments
core: 8.x
package: Acquia Learning
lotus.offers_controller_hello:
path: '/offers/hot/{count}'
defaults:
_controller: '\Drupal\lotus\Controller\OffersController::hello'
_title: 'Offers'
requirements:
_permission: 'access content'
<?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 OffersController.
*
* @package Drupal\lotus\Controller
*/
class OffersController extends ControllerBase {
/**
* Hello.
*
* @return string
* Return Hello string.
*/
public function hello($count) {
return [
'#type' => 'markup',
'#markup' => $this->t('You will get %count% discount!!', array('%count' => $count)),
];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment