Using views for CRUDding saved reports.
This commit is contained in:
parent
7e1889346b
commit
b5f718647e
@ -1,5 +1,5 @@
|
|||||||
entity.opencase_report.add_form:
|
entity.opencase_report.create_new:
|
||||||
route_name: entity.opencase_report.add_form
|
route_name: view.reporting_actors.page_1
|
||||||
title: 'Add OpenCase Report'
|
title: 'Create a new report'
|
||||||
appears_on:
|
appears_on:
|
||||||
- entity.opencase_report.collection
|
- view.opencase_saved_reports.page_1
|
||||||
|
@ -157,24 +157,7 @@ class OpenCaseReport extends ContentEntityBase implements OpenCaseReportInterfac
|
|||||||
->setRevisionable(TRUE)
|
->setRevisionable(TRUE)
|
||||||
->setSetting('target_type', 'user')
|
->setSetting('target_type', 'user')
|
||||||
->setSetting('handler', 'default')
|
->setSetting('handler', 'default')
|
||||||
->setTranslatable(TRUE)
|
->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);
|
|
||||||
|
|
||||||
$fields['name'] = BaseFieldDefinition::create('string')
|
$fields['name'] = BaseFieldDefinition::create('string')
|
||||||
->setLabel(t('Name'))
|
->setLabel(t('Name'))
|
||||||
@ -193,18 +176,12 @@ class OpenCaseReport extends ContentEntityBase implements OpenCaseReportInterfac
|
|||||||
'type' => 'string_textfield',
|
'type' => 'string_textfield',
|
||||||
'weight' => -4,
|
'weight' => -4,
|
||||||
])
|
])
|
||||||
->setDisplayConfigurable('form', TRUE)
|
|
||||||
->setDisplayConfigurable('view', TRUE)
|
|
||||||
->setRequired(TRUE);
|
->setRequired(TRUE);
|
||||||
|
|
||||||
$fields['status'] = BaseFieldDefinition::create('boolean')
|
$fields['status'] = BaseFieldDefinition::create('boolean')
|
||||||
->setLabel(t('Publishing status'))
|
->setLabel(t('Publishing status'))
|
||||||
->setDescription(t('A boolean indicating whether the OpenCase Report is published.'))
|
->setDescription(t('A boolean indicating whether the OpenCase Report is published.'))
|
||||||
->setDefaultValue(TRUE)
|
->setDefaultValue(TRUE);
|
||||||
->setDisplayOptions('form', [
|
|
||||||
'type' => 'boolean_checkbox',
|
|
||||||
'weight' => -3,
|
|
||||||
]);
|
|
||||||
|
|
||||||
$fields['created'] = BaseFieldDefinition::create('created')
|
$fields['created'] = BaseFieldDefinition::create('created')
|
||||||
->setLabel(t('Created'))
|
->setLabel(t('Created'))
|
||||||
|
@ -44,7 +44,7 @@ class OpenCaseReportForm extends ContentEntityForm {
|
|||||||
'%label' => $entity->label(),
|
'%label' => $entity->label(),
|
||||||
]));
|
]));
|
||||||
}
|
}
|
||||||
$form_state->setRedirect('entity.opencase_report.canonical', ['opencase_report' => $entity->id()]);
|
$form_state->setRedirect('view.opencase_saved_reports.page_1');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user