Minor changes to reporting forms

This commit is contained in:
Naomi 2018-09-17 12:24:43 +01:00
parent 354bb0adba
commit 7a61f76a93
3 changed files with 5 additions and 9 deletions

View File

@ -1,6 +1,6 @@
entity.opencase_report.add_form: entity.opencase_report.add_form:
route_name: entity.opencase_report.add_form route_name: entity.opencase_report.add_form
title: 'Add OpenCase Report' title: 'New Report'
appears_on: appears_on:
- entity.opencase_report.collection - entity.opencase_report.collection

View File

@ -19,10 +19,9 @@ class OpenCaseReportForm extends EntityForm {
$opencase_report = $this->entity; $opencase_report = $this->entity;
$form['label'] = [ $form['label'] = [
'#type' => 'textfield', '#type' => 'textfield',
'#title' => $this->t('Label'), '#title' => $this->t('Report Title'),
'#maxlength' => 255, '#maxlength' => 255,
'#default_value' => $opencase_report->label(), '#default_value' => $opencase_report->label(),
'#description' => $this->t("Label for the OpenCase Report."),
'#required' => TRUE, '#required' => TRUE,
]; ];
@ -49,13 +48,13 @@ class OpenCaseReportForm extends EntityForm {
switch ($status) { switch ($status) {
case SAVED_NEW: case SAVED_NEW:
drupal_set_message($this->t('Created the %label OpenCase Report.', [ drupal_set_message($this->t('Created report: %label.', [
'%label' => $opencase_report->label(), '%label' => $opencase_report->label(),
])); ]));
break; break;
default: default:
drupal_set_message($this->t('Saved the %label OpenCase Report.', [ drupal_set_message($this->t('Saved report: %label.', [
'%label' => $opencase_report->label(), '%label' => $opencase_report->label(),
])); ]));
} }

View File

@ -14,8 +14,7 @@ class OpenCaseReportListBuilder extends ConfigEntityListBuilder {
* {@inheritdoc} * {@inheritdoc}
*/ */
public function buildHeader() { public function buildHeader() {
$header['label'] = $this->t('OpenCase Report'); $header['label'] = $this->t('Report');
$header['id'] = $this->t('Machine name');
return $header + parent::buildHeader(); return $header + parent::buildHeader();
} }
@ -24,8 +23,6 @@ class OpenCaseReportListBuilder extends ConfigEntityListBuilder {
*/ */
public function buildRow(EntityInterface $entity) { public function buildRow(EntityInterface $entity) {
$row['label'] = $entity->label(); $row['label'] = $entity->label();
$row['id'] = $entity->id();
// You probably want a few more properties here...
return $row + parent::buildRow($entity); return $row + parent::buildRow($entity);
} }