Added files field to organisation (base field definition and update hook) and bumped version to 0.198
This commit is contained in:
parent
36eb9d9667
commit
2b9cd117ba
@ -3,6 +3,32 @@
|
|||||||
|
|
||||||
use \Drupal\Core\Entity\Sql\SqlContentEntityStorageSchemaConverter;
|
use \Drupal\Core\Entity\Sql\SqlContentEntityStorageSchemaConverter;
|
||||||
|
|
||||||
|
function opencase_entities_update_80198() {
|
||||||
|
$field_storage_definition = \Drupal\Core\Field\BaseFieldDefinition::create('file')
|
||||||
|
->setLabel(t('Files'))
|
||||||
|
->setDescription(t('Files relating to this organisation'))
|
||||||
|
->setSetting('file_directory', '[date:custom:Y]-[date:custom:m]')
|
||||||
|
->setSetting('handler', 'default:file')
|
||||||
|
->setSetting('file_extensions', 'txt jpg jpeg gif rtf xls xlsx doc swf png pdf docx csv')
|
||||||
|
->setSetting('description_field', 'true')
|
||||||
|
->setSetting('uri_scheme', 'private')
|
||||||
|
->setCardinality(-1)
|
||||||
|
->setDisplayOptions('form', [
|
||||||
|
'type' => 'file_generic',
|
||||||
|
'weight' => 61,
|
||||||
|
'settings' => [
|
||||||
|
'progress_indicator' => 'throbber',
|
||||||
|
],
|
||||||
|
])
|
||||||
|
->setDisplayOptions('view', [
|
||||||
|
'label' => 'above',
|
||||||
|
'settings' => ['use_description_as_link_text' => 'true']
|
||||||
|
]);
|
||||||
|
|
||||||
|
\Drupal::entityDefinitionUpdateManager()
|
||||||
|
->installFieldStorageDefinition('organisation_files', 'oc_organisation', 'opencase_entities', $field_storage_definition);
|
||||||
|
}
|
||||||
|
|
||||||
function opencase_entities_update_80197() {
|
function opencase_entities_update_80197() {
|
||||||
//check if the table exists first. If not, then create the entity.
|
//check if the table exists first. If not, then create the entity.
|
||||||
if(!db_table_exists('oc_organisation')) {
|
if(!db_table_exists('oc_organisation')) {
|
||||||
|
@ -436,6 +436,26 @@ class OCOrganisation extends EditorialContentEntityBase implements OCOrganisatio
|
|||||||
->setRevisionable(TRUE)
|
->setRevisionable(TRUE)
|
||||||
->setTranslatable(TRUE);
|
->setTranslatable(TRUE);
|
||||||
|
|
||||||
|
$fields['files'] = BaseFieldDefinition::create('file')
|
||||||
|
->setLabel(t('Files'))
|
||||||
|
->setDescription(t('Files relating to this organisation'))
|
||||||
|
->setSetting('file_directory', '[date:custom:Y]-[date:custom:m]')
|
||||||
|
->setSetting('handler', 'default:file')
|
||||||
|
->setSetting('file_extensions', 'txt jpg jpeg gif rtf xls xlsx doc swf png pdf docx csv')
|
||||||
|
->setSetting('description_field', 'true')
|
||||||
|
->setSetting('uri_scheme', 'private')
|
||||||
|
->setCardinality(-1)
|
||||||
|
->setDisplayOptions('form', [
|
||||||
|
'type' => 'file_generic',
|
||||||
|
'weight' => 61,
|
||||||
|
'settings' => [
|
||||||
|
'progress_indicator' => 'throbber',
|
||||||
|
],
|
||||||
|
])
|
||||||
|
->setDisplayOptions('view', [
|
||||||
|
'label' => 'above',
|
||||||
|
'settings' => ['use_description_as_link_text' => 'true']
|
||||||
|
]);
|
||||||
return $fields;
|
return $fields;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ name: 'OpenCase'
|
|||||||
type: module
|
type: module
|
||||||
description: 'Simple Case Management'
|
description: 'Simple Case Management'
|
||||||
core: 8.x
|
core: 8.x
|
||||||
version: 8.x-1.9.2
|
version: 8.x-1.9.8
|
||||||
package: 'OpenCase'
|
package: 'OpenCase'
|
||||||
dependencies:
|
dependencies:
|
||||||
- opencase_entities
|
- opencase_entities
|
||||||
|
Reference in New Issue
Block a user