Skip to content

Instantly share code, notes, and snippets.

@prasadshir
Created March 7, 2017 14:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save prasadshir/0bbba050e9f5cd16591822f9d143702c to your computer and use it in GitHub Desktop.
Save prasadshir/0bbba050e9f5cd16591822f9d143702c to your computer and use it in GitHub Desktop.
D728:Task-03: Create a custom block
<?php
/**
* Controller for the Block in the lotus module for D8.
* Add this file to src/Plugin/Block/ folder of the module
**/
namespace Drupal\lotus\Plugin\Block;
use Drupal\Core\Block\BlockBase;
/**
* Provides a 'Hello' Block
*
* @Block(
* id = "hello_block",
* admin_label = @Translation("Hello block"),
* )
*/
class HelloBlock extends BlockBase {
/**
* {@inheritdoc}
*/
public function build() {
return array(
'#markup' => $this->t('Welcome to Lotus website!'),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment