added see al org's page and menu item, made fields configurable for actor
This commit is contained in:
parent
b85cbaf398
commit
20ed3d4f39
@ -267,6 +267,7 @@ class OCActivity extends RevisionableContentEntityBase implements OCActivityInte
|
|||||||
->setDescription('If this box is not ticked this record will be hidden from view for most users. Users with access to unpublished entities will be able to restore it if needed.')
|
->setDescription('If this box is not ticked this record will be hidden from view for most users. Users with access to unpublished entities will be able to restore it if needed.')
|
||||||
->setRevisionable(TRUE)
|
->setRevisionable(TRUE)
|
||||||
->setDisplayConfigurable('form', TRUE)
|
->setDisplayConfigurable('form', TRUE)
|
||||||
|
->setDisplayConfigurable('view', true)
|
||||||
->setDefaultValue(TRUE);
|
->setDefaultValue(TRUE);
|
||||||
|
|
||||||
$fields['user_id'] = BaseFieldDefinition::create('entity_reference')
|
$fields['user_id'] = BaseFieldDefinition::create('entity_reference')
|
||||||
@ -277,10 +278,7 @@ class OCActivity extends RevisionableContentEntityBase implements OCActivityInte
|
|||||||
->setSetting('handler', 'default')
|
->setSetting('handler', 'default')
|
||||||
->setTranslatable(TRUE)
|
->setTranslatable(TRUE)
|
||||||
->setDisplayConfigurable('view', true)
|
->setDisplayConfigurable('view', true)
|
||||||
->setDisplayOptions('view', [
|
->setDisplayConfigurable('form', TRUE);
|
||||||
'label' => 'above',
|
|
||||||
'type' => 'author',
|
|
||||||
]);
|
|
||||||
|
|
||||||
$fields['name'] = BaseFieldDefinition::create('string')
|
$fields['name'] = BaseFieldDefinition::create('string')
|
||||||
->setLabel(t('Subject'))
|
->setLabel(t('Subject'))
|
||||||
@ -292,15 +290,6 @@ class OCActivity extends RevisionableContentEntityBase implements OCActivityInte
|
|||||||
->setDefaultValue('')
|
->setDefaultValue('')
|
||||||
->setDisplayConfigurable('form', true)
|
->setDisplayConfigurable('form', true)
|
||||||
->setDisplayConfigurable('view', true)
|
->setDisplayConfigurable('view', true)
|
||||||
->setDisplayOptions('view', [
|
|
||||||
'label' => 'hidden',
|
|
||||||
'type' => 'string',
|
|
||||||
'weight' => -3,
|
|
||||||
])
|
|
||||||
->setDisplayOptions('form', [
|
|
||||||
'type' => 'string_textfield',
|
|
||||||
'weight' => -3,
|
|
||||||
])
|
|
||||||
->setRequired(TRUE);
|
->setRequired(TRUE);
|
||||||
|
|
||||||
$fields['description'] = BaseFieldDefinition::create('string_long')
|
$fields['description'] = BaseFieldDefinition::create('string_long')
|
||||||
@ -310,7 +299,6 @@ class OCActivity extends RevisionableContentEntityBase implements OCActivityInte
|
|||||||
'max_length' => 50,
|
'max_length' => 50,
|
||||||
'text_processing' => 0,
|
'text_processing' => 0,
|
||||||
])
|
])
|
||||||
->setDefaultValue('')
|
|
||||||
->setDisplayConfigurable('form', true)
|
->setDisplayConfigurable('form', true)
|
||||||
->setDisplayConfigurable('view', true)
|
->setDisplayConfigurable('view', true)
|
||||||
->setRequired(FALSE);
|
->setRequired(FALSE);
|
||||||
@ -322,15 +310,7 @@ class OCActivity extends RevisionableContentEntityBase implements OCActivityInte
|
|||||||
'suffix' => 'minutes',
|
'suffix' => 'minutes',
|
||||||
])
|
])
|
||||||
->SetDisplayConfigurable("form", true)
|
->SetDisplayConfigurable("form", true)
|
||||||
->SetDisplayConfigurable("view", true)
|
->SetDisplayConfigurable("view", true);
|
||||||
->setDefaultValue('')
|
|
||||||
->setDisplayOptions('view', [
|
|
||||||
'label' => 'above',
|
|
||||||
'weight' => -3,
|
|
||||||
])
|
|
||||||
->setDisplayOptions('form', [
|
|
||||||
'weight' => -3,
|
|
||||||
]);
|
|
||||||
|
|
||||||
$fields['created'] = BaseFieldDefinition::create('created')
|
$fields['created'] = BaseFieldDefinition::create('created')
|
||||||
->setLabel(t('Created'))
|
->setLabel(t('Created'))
|
||||||
|
@ -218,6 +218,7 @@ class OCActor extends RevisionableContentEntityBase implements OCActorInterface
|
|||||||
->setDescription('If this box is not ticked this record will be hidden from view for most users. Users with access to unpublished entities will be able to restore it if needed.')
|
->setDescription('If this box is not ticked this record will be hidden from view for most users. Users with access to unpublished entities will be able to restore it if needed.')
|
||||||
->setRevisionable(TRUE)
|
->setRevisionable(TRUE)
|
||||||
->setDisplayConfigurable("form", true)
|
->setDisplayConfigurable("form", true)
|
||||||
|
->setDisplayConfigurable("view", true)
|
||||||
->setDefaultValue(TRUE);
|
->setDefaultValue(TRUE);
|
||||||
|
|
||||||
// The name gets set on preSave, from the first middle and last
|
// The name gets set on preSave, from the first middle and last
|
||||||
@ -234,6 +235,8 @@ class OCActor extends RevisionableContentEntityBase implements OCActorInterface
|
|||||||
->setRevisionable(TRUE)
|
->setRevisionable(TRUE)
|
||||||
->setSetting('target_type', 'user')
|
->setSetting('target_type', 'user')
|
||||||
->setSetting('handler', 'default')
|
->setSetting('handler', 'default')
|
||||||
|
->setDisplayConfigurable("form", true)
|
||||||
|
->setDisplayConfigurable("view", true)
|
||||||
->setTranslatable(TRUE);
|
->setTranslatable(TRUE);
|
||||||
|
|
||||||
$fields['first_name'] = BaseFieldDefinition::create('string')
|
$fields['first_name'] = BaseFieldDefinition::create('string')
|
||||||
@ -247,10 +250,6 @@ class OCActor extends RevisionableContentEntityBase implements OCActorInterface
|
|||||||
->setDisplayConfigurable("form", true)
|
->setDisplayConfigurable("form", true)
|
||||||
->setDisplayConfigurable("view", true)
|
->setDisplayConfigurable("view", true)
|
||||||
->setDefaultValue('')
|
->setDefaultValue('')
|
||||||
->setDisplayOptions('form', [
|
|
||||||
'type' => 'string_textfield',
|
|
||||||
'weight' => -100,
|
|
||||||
])
|
|
||||||
->setRequired(TRUE);
|
->setRequired(TRUE);
|
||||||
|
|
||||||
$fields['middle_names'] = BaseFieldDefinition::create('string')
|
$fields['middle_names'] = BaseFieldDefinition::create('string')
|
||||||
@ -264,10 +263,6 @@ class OCActor extends RevisionableContentEntityBase implements OCActorInterface
|
|||||||
->setDisplayConfigurable("form", true)
|
->setDisplayConfigurable("form", true)
|
||||||
->setDisplayConfigurable("view", true)
|
->setDisplayConfigurable("view", true)
|
||||||
->setDefaultValue('')
|
->setDefaultValue('')
|
||||||
->setDisplayOptions('form', [
|
|
||||||
'type' => 'string_textfield',
|
|
||||||
'weight' => -99,
|
|
||||||
])
|
|
||||||
->setRequired(FALSE);
|
->setRequired(FALSE);
|
||||||
|
|
||||||
$fields['last_name'] = BaseFieldDefinition::create('string')
|
$fields['last_name'] = BaseFieldDefinition::create('string')
|
||||||
@ -281,10 +276,6 @@ class OCActor extends RevisionableContentEntityBase implements OCActorInterface
|
|||||||
'text_processing' => 0,
|
'text_processing' => 0,
|
||||||
])
|
])
|
||||||
->setDefaultValue('')
|
->setDefaultValue('')
|
||||||
->setDisplayOptions('form', [
|
|
||||||
'type' => 'string_textfield',
|
|
||||||
'weight' => -98,
|
|
||||||
])
|
|
||||||
->setRequired(TRUE);
|
->setRequired(TRUE);
|
||||||
|
|
||||||
// Contact details.
|
// Contact details.
|
||||||
@ -297,16 +288,7 @@ class OCActor extends RevisionableContentEntityBase implements OCActorInterface
|
|||||||
'text_processing' => 0,
|
'text_processing' => 0,
|
||||||
))
|
))
|
||||||
->setDisplayConfigurable("form", true)
|
->setDisplayConfigurable("form", true)
|
||||||
->setDisplayConfigurable("view", true)
|
->setDisplayConfigurable("view", true);
|
||||||
->setDisplayOptions('view', array(
|
|
||||||
'label' => 'above',
|
|
||||||
'type' => 'string',
|
|
||||||
'weight' => -5,
|
|
||||||
))
|
|
||||||
->setDisplayOptions('form', array(
|
|
||||||
'type' => 'string_textfield',
|
|
||||||
'weight' => -5,
|
|
||||||
));
|
|
||||||
$fields['phone'] = BaseFieldDefinition::create('string')
|
$fields['phone'] = BaseFieldDefinition::create('string')
|
||||||
->setLabel(t('Main Phone Number'))
|
->setLabel(t('Main Phone Number'))
|
||||||
->setRevisionable(TRUE)
|
->setRevisionable(TRUE)
|
||||||
@ -316,16 +298,7 @@ class OCActor extends RevisionableContentEntityBase implements OCActorInterface
|
|||||||
'text_processing' => 0,
|
'text_processing' => 0,
|
||||||
))
|
))
|
||||||
->setDisplayConfigurable("form", true)
|
->setDisplayConfigurable("form", true)
|
||||||
->setDisplayConfigurable("view", true)
|
->setDisplayConfigurable("view", true);
|
||||||
->setDisplayOptions('view', array(
|
|
||||||
'label' => 'above',
|
|
||||||
'type' => 'string',
|
|
||||||
'weight' => -4,
|
|
||||||
))
|
|
||||||
->setDisplayOptions('form', array(
|
|
||||||
'type' => 'string_textfield',
|
|
||||||
'weight' => -4,
|
|
||||||
));
|
|
||||||
$fields['phone2'] = BaseFieldDefinition::create('string')
|
$fields['phone2'] = BaseFieldDefinition::create('string')
|
||||||
->setRevisionable(TRUE)
|
->setRevisionable(TRUE)
|
||||||
->setLabel(t('Alternative Phone Number'))
|
->setLabel(t('Alternative Phone Number'))
|
||||||
@ -335,16 +308,7 @@ class OCActor extends RevisionableContentEntityBase implements OCActorInterface
|
|||||||
'text_processing' => 0,
|
'text_processing' => 0,
|
||||||
))
|
))
|
||||||
->setDisplayConfigurable("form", true)
|
->setDisplayConfigurable("form", true)
|
||||||
->setDisplayConfigurable("view", true)
|
->setDisplayConfigurable("view", true);
|
||||||
->setDisplayOptions('view', array(
|
|
||||||
'label' => 'above',
|
|
||||||
'type' => 'string',
|
|
||||||
'weight' => -3,
|
|
||||||
))
|
|
||||||
->setDisplayOptions('form', array(
|
|
||||||
'type' => 'string_textfield',
|
|
||||||
'weight' => -3,
|
|
||||||
));
|
|
||||||
$fields['postal_address'] = BaseFieldDefinition::create('string_long')
|
$fields['postal_address'] = BaseFieldDefinition::create('string_long')
|
||||||
->setRevisionable(TRUE)
|
->setRevisionable(TRUE)
|
||||||
->setLabel(t('Postal Address'))
|
->setLabel(t('Postal Address'))
|
||||||
@ -355,16 +319,7 @@ class OCActor extends RevisionableContentEntityBase implements OCActorInterface
|
|||||||
'text_processing' => 0,
|
'text_processing' => 0,
|
||||||
))
|
))
|
||||||
->setDisplayConfigurable("form", true)
|
->setDisplayConfigurable("form", true)
|
||||||
->setDisplayConfigurable("view", true)
|
->setDisplayConfigurable("view", true);
|
||||||
->setDisplayOptions('view', array(
|
|
||||||
'label' => 'above',
|
|
||||||
'type' => 'basic_string',
|
|
||||||
'weight' => -2,
|
|
||||||
))
|
|
||||||
->setDisplayOptions('form', array(
|
|
||||||
'type' => 'string_textarea',
|
|
||||||
'weight' => -2,
|
|
||||||
));
|
|
||||||
$fields['post_code'] = BaseFieldDefinition::create('string')
|
$fields['post_code'] = BaseFieldDefinition::create('string')
|
||||||
->setRevisionable(TRUE)
|
->setRevisionable(TRUE)
|
||||||
->setLabel(t('Post Code'))
|
->setLabel(t('Post Code'))
|
||||||
@ -374,16 +329,7 @@ class OCActor extends RevisionableContentEntityBase implements OCActorInterface
|
|||||||
'text_processing' => 0,
|
'text_processing' => 0,
|
||||||
))
|
))
|
||||||
->setDisplayConfigurable("form", true)
|
->setDisplayConfigurable("form", true)
|
||||||
->setDisplayConfigurable("view", true)
|
->setDisplayConfigurable("view", true);
|
||||||
->setDisplayOptions('view', array(
|
|
||||||
'label' => 'above',
|
|
||||||
'type' => 'string',
|
|
||||||
'weight' => -1,
|
|
||||||
))
|
|
||||||
->setDisplayOptions('form', array(
|
|
||||||
'type' => 'string_textfield',
|
|
||||||
'weight' => -1,
|
|
||||||
));
|
|
||||||
|
|
||||||
$fields['created'] = BaseFieldDefinition::create('created')
|
$fields['created'] = BaseFieldDefinition::create('created')
|
||||||
->setLabel(t('Created'))
|
->setLabel(t('Created'))
|
||||||
@ -400,13 +346,6 @@ class OCActor extends RevisionableContentEntityBase implements OCActorInterface
|
|||||||
->setRevisionable(TRUE)
|
->setRevisionable(TRUE)
|
||||||
->setTranslatable(TRUE);
|
->setTranslatable(TRUE);
|
||||||
|
|
||||||
$fields['user_login'] = BaseFieldDefinition::create('boolean')
|
|
||||||
->setLabel(t('Login Access'))
|
|
||||||
->setDescription(t('Whether this person should be able to log into the system.'))
|
|
||||||
->setDisplayConfigurable('form', true)
|
|
||||||
->setDisplayConfigurable('display', true)
|
|
||||||
->setDefaultValue(FALSE);
|
|
||||||
|
|
||||||
return $fields;
|
return $fields;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,6 +8,11 @@ opencase.see_all_people_links:
|
|||||||
deriver: Drupal\opencase\Plugin\Derivative\SeeAllActorsMenuLink
|
deriver: Drupal\opencase\Plugin\Derivative\SeeAllActorsMenuLink
|
||||||
menu_name: opencase
|
menu_name: opencase
|
||||||
parent: opencase.see_all
|
parent: opencase.see_all
|
||||||
|
opencase.see_all_organisations_links:
|
||||||
|
class: Drupal\opencase\Plugin\Menu\SeeAllOrganisationsMenuLink
|
||||||
|
deriver: Drupal\opencase\Plugin\Derivative\SeeAllOrganisationsMenuLink
|
||||||
|
menu_name: opencase
|
||||||
|
parent: opencase.see_all
|
||||||
opencase.opencase_add_new_things_menu:
|
opencase.opencase_add_new_things_menu:
|
||||||
title: 'Add new...'
|
title: 'Add new...'
|
||||||
menu_name: opencase
|
menu_name: opencase
|
||||||
|
55
src/Plugin/Derivative/SeeAllOrganisationsMenuLink.php
Normal file
55
src/Plugin/Derivative/SeeAllOrganisationsMenuLink.php
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Drupal\opencase\Plugin\Derivative;
|
||||||
|
|
||||||
|
use Drupal\Component\Plugin\Derivative\DeriverBase;
|
||||||
|
use Drupal\Core\Plugin\Discovery\ContainerDeriverInterface;
|
||||||
|
use Drupal\Core\Entity\EntityTypeManagerInterface;
|
||||||
|
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Derivative class that provides the menu links adding various types of organisations
|
||||||
|
*/
|
||||||
|
class SeeAllOrganisationsMenuLink extends DeriverBase implements ContainerDeriverInterface {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var EntityTypeManagerInterface $entityTypeManager.
|
||||||
|
*/
|
||||||
|
|
||||||
|
protected $entityTypeManager;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a AddActorsMenuLink instance.
|
||||||
|
*
|
||||||
|
* @param $base_plugin_id
|
||||||
|
* @param EntityTypeManagerInterface $entity_type_manager
|
||||||
|
*/
|
||||||
|
public function __construct($base_plugin_id, EntityTypeManagerInterface $entity_type_manager) {
|
||||||
|
$this->entityTypeManager = $entity_type_manager;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public static function create(ContainerInterface $container, $base_plugin_id) {
|
||||||
|
return new static(
|
||||||
|
$base_plugin_id,
|
||||||
|
$container->get('entity_type.manager')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function getDerivativeDefinitions($base_plugin_definition) {
|
||||||
|
$links = [];
|
||||||
|
$organisationTypes = $this->entityTypeManager->getStorage('oc_organisation_type')->loadMultiple();
|
||||||
|
foreach ($organisationTypes as $id => $organisationType) {
|
||||||
|
$links[$id] = [
|
||||||
|
'title' => $organisationType->label(),
|
||||||
|
'route_name' => "view.organisations.page_1",
|
||||||
|
'route_parameters' => ['type' => $organisationType->id()]
|
||||||
|
] + $base_plugin_definition;
|
||||||
|
}
|
||||||
|
return $links;
|
||||||
|
}
|
||||||
|
}
|
9
src/Plugin/Menu/SeeAllOrganisationsMenuLink.php
Normal file
9
src/Plugin/Menu/SeeAllOrganisationsMenuLink.php
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<?php
|
||||||
|
namespace Drupal\opencase\Plugin\Menu;
|
||||||
|
|
||||||
|
use Drupal\Core\Menu\MenuLinkDefault;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents a menu link for seeing all organisations of various types.
|
||||||
|
*/
|
||||||
|
class SeeAllOrganisationsMenuLink extends MenuLinkDefault {}
|
Reference in New Issue
Block a user