created materio_sapi module and draft of search form block
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\materio_sapi\Plugin\Block;
|
||||
|
||||
use Drupal\Core\Block\BlockBase;
|
||||
use Drupal\Core\Session\AccountInterface;
|
||||
use Drupal\Core\Access\AccessResult;
|
||||
|
||||
/**
|
||||
* Provides a 'MaterioSapiSearchBlock' block.
|
||||
*
|
||||
* @Block(
|
||||
* id = "materio_sapi_search_block",
|
||||
* admin_label = @Translation("Materio sapi search block"),
|
||||
* )
|
||||
*/
|
||||
class MaterioSapiSearchBlock extends BlockBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function build() {
|
||||
$build = [];
|
||||
// $build['materio_sapi_search_block']['#markup'] = 'Implement MaterioSapiSearchBlock.';
|
||||
$form = \Drupal::formBuilder()->getForm('Drupal\materio_sapi\Form\MaterioSapiSearchForm');
|
||||
$build['materio_sapi_search_block'] = $form;
|
||||
return $build;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function blockAccess(AccountInterface $account) {
|
||||
return AccessResult::allowedIfHasPermission($account, 'access materio search');
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user