BlockFieldTestTimeBlock.php in Block field 8
Namespace
Drupal\block_field_test\Plugin\BlockFile
tests/modules/block_field_test/src/Plugin/Block/BlockFieldTestTimeBlock.phpView source
<?php
namespace Drupal\block_field_test\Plugin\Block;
use Drupal\Core\Block\BlockBase;
/**
* Provides a 'Block field test time' block.
*
* @Block(
* id = "block_field_test_time",
* admin_label = @Translation("The time is..."),
* category = @Translation("Block field test")
* )
*/
class BlockFieldTestTimeBlock extends BlockBase {
/**
* {@inheritdoc}
*/
public function build() {
return [
'#type' => 'markup',
'#markup' => date('H:i:s') . ' (' . time() . ')',
];
}
/**
* {@inheritdoc}
*/
public function getCacheMaxAge() {
return 0;
}
}
Classes
Name | Description |
---|---|
BlockFieldTestTimeBlock | Provides a 'Block field test time' block. |