Added block plugin for report form, to show on reporting page.
This commit is contained in:
parent
7a61f76a93
commit
c48f58d49b
@ -1,5 +1,5 @@
|
|||||||
entity.opencase_report.add_form:
|
entity.opencase_report.add_form:
|
||||||
route_name: entity.opencase_report.add_form
|
route_name: view.reporting_actors.page_1
|
||||||
title: 'New Report'
|
title: 'New Report'
|
||||||
appears_on:
|
appears_on:
|
||||||
- entity.opencase_report.collection
|
- entity.opencase_report.collection
|
||||||
|
26
modules/opencase_reporting/src/Plugin/Block/ReportForm.php
Normal file
26
modules/opencase_reporting/src/Plugin/Block/ReportForm.php
Normal 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Reference in New Issue
Block a user