Added block plugin for report form, to show on reporting page.

This commit is contained in:
Naomi 2018-09-17 17:21:31 +01:00
parent 7a61f76a93
commit c48f58d49b
2 changed files with 27 additions and 1 deletions

View File

@ -1,5 +1,5 @@
entity.opencase_report.add_form:
route_name: entity.opencase_report.add_form
route_name: view.reporting_actors.page_1
title: 'New Report'
appears_on:
- entity.opencase_report.collection

View File

@ -0,0 +1,26 @@
<?php
namespace Drupal\opencase_reporting\Plugin\Block;
use Drupal\Core\Block\BlockBase;
/**
* Provides a 'ReportForm' block.
*
* @Block(
* id = "opencase_report_form",
* admin_label = @Translation("Report form"),
* )
*/
class ReportForm extends BlockBase {
/**
* {@inheritdoc}
*/
public function build() {
$report = \Drupal::entityManager()->getStorage('opencase_report')->create();
$form = \Drupal::service('entity.form_builder')->getForm($report, 'add');
return $form;
}
}