Using views for CRUDding saved reports.

This commit is contained in:
Naomi 2018-09-17 18:49:20 +01:00
parent 7e1889346b
commit b5f718647e
3 changed files with 7 additions and 30 deletions

View File

@ -1,5 +1,5 @@
entity.opencase_report.add_form:
route_name: entity.opencase_report.add_form
title: 'Add OpenCase Report'
entity.opencase_report.create_new:
route_name: view.reporting_actors.page_1
title: 'Create a new report'
appears_on:
- entity.opencase_report.collection
- view.opencase_saved_reports.page_1

View File

@ -157,24 +157,7 @@ class OpenCaseReport extends ContentEntityBase implements OpenCaseReportInterfac
->setRevisionable(TRUE)
->setSetting('target_type', 'user')
->setSetting('handler', 'default')
->setTranslatable(TRUE)
->setDisplayOptions('view', [
'label' => 'hidden',
'type' => 'author',
'weight' => 0,
])
->setDisplayOptions('form', [
'type' => 'entity_reference_autocomplete',
'weight' => 5,
'settings' => [
'match_operator' => 'CONTAINS',
'size' => '60',
'autocomplete_type' => 'tags',
'placeholder' => '',
],
])
->setDisplayConfigurable('form', TRUE)
->setDisplayConfigurable('view', TRUE);
->setTranslatable(TRUE);
$fields['name'] = BaseFieldDefinition::create('string')
->setLabel(t('Name'))
@ -193,18 +176,12 @@ class OpenCaseReport extends ContentEntityBase implements OpenCaseReportInterfac
'type' => 'string_textfield',
'weight' => -4,
])
->setDisplayConfigurable('form', TRUE)
->setDisplayConfigurable('view', TRUE)
->setRequired(TRUE);
$fields['status'] = BaseFieldDefinition::create('boolean')
->setLabel(t('Publishing status'))
->setDescription(t('A boolean indicating whether the OpenCase Report is published.'))
->setDefaultValue(TRUE)
->setDisplayOptions('form', [
'type' => 'boolean_checkbox',
'weight' => -3,
]);
->setDefaultValue(TRUE);
$fields['created'] = BaseFieldDefinition::create('created')
->setLabel(t('Created'))

View File

@ -44,7 +44,7 @@ class OpenCaseReportForm extends ContentEntityForm {
'%label' => $entity->label(),
]));
}
$form_state->setRedirect('entity.opencase_report.canonical', ['opencase_report' => $entity->id()]);
$form_state->setRedirect('view.opencase_saved_reports.page_1');
}
}