I've created my own module in drupal 8. I also created block in my module. I tryied to add my custom block (which is type of custom form) to view. But when I am trying to add custom block in view, its not appearing in the list. Block is only appearing in block layout. What is wrong or is there other way of adding custom block from module to your view in drupal 8?
<?php
/**
* @file
* Contains \Drupal\reviewhelper\Plugin\Block\ReviewHelperBlock.
*/
namespace Drupal\reviewhelper\Plugin\Block;
use Drupal\reviewhelper\Form;
use Drupal\Core\Block\BlockBase;
use Drupal\Core\Form\FormStateInterface;
/**
* Provides a 'ReviewHelper' Block
*
* @Block(
* id = "ReviewHelper",
* admin_label = @Translation("Review helper block"),
* category = @Translation("Custom Blocks"),
* )
*/
class ReviewHelperBlock extends BlockBase {
/**
* {@inheritdoc}
*/
public function build() {
$form = \Drupal::formBuilder()->getForm('Drupal\reviewhelper\Form\ReviewHelperPush');
return $form;
}
}