Compare commits
8 Commits
demo
...
0c977a7d48
Author | SHA1 | Date | |
---|---|---|---|
0c977a7d48 | |||
a4c02ed249 | |||
a0e4b4028f | |||
5c20e83ed5 | |||
78b8371be9 | |||
48e6ae4196 | |||
ac4e6eddd5 | |||
b1a8534d29 |
@ -3,6 +3,16 @@
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* MOVE THIS INTO GNO! */
|
||||
#block-accreditationcount {
|
||||
position: absolute;
|
||||
right: 50%;
|
||||
}
|
||||
|
||||
#block-accreditationcount td {
|
||||
color: black;
|
||||
}
|
||||
|
||||
/* */
|
||||
|
||||
body {
|
||||
@ -123,3 +133,36 @@ table.views-table.views-view-table caption {
|
||||
form.oc-organisation-relation-form tr:first-child {
|
||||
display: none;
|
||||
}
|
||||
|
||||
|
||||
/* trav styling */
|
||||
.site-branding {
|
||||
margin-top: -2.20em !important;
|
||||
}
|
||||
|
||||
.follow-up-due {
|
||||
|
||||
}
|
||||
|
||||
tr:nth-child(even) {
|
||||
background-color: #fefefe;
|
||||
}
|
||||
|
||||
.off {
|
||||
background-color:black;
|
||||
}
|
||||
|
||||
.field--type-entity-reference-revisions {
|
||||
border-radius: 25px;
|
||||
border: 2px solid #2A419A;
|
||||
padding: 10px;
|
||||
border-width: thin;
|
||||
}
|
||||
|
||||
.follow-ups-due {
|
||||
background-color: #FB8A4F;
|
||||
}
|
||||
|
||||
.views-field-field-client-substatus {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
@ -206,8 +206,9 @@ class OCCase extends RevisionableContentEntityBase implements OCCaseInterface {
|
||||
// not currently used. Will add form and view settings when ready
|
||||
$fields['status'] = BaseFieldDefinition::create('boolean')
|
||||
->setLabel(t('Publishing status'))
|
||||
->setDescription(t('A boolean indicating whether the Case is published.'))
|
||||
->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)
|
||||
->setDisplayConfigurable("form", TRUE)
|
||||
->setDefaultValue(TRUE);
|
||||
|
||||
$fields['user_id'] = BaseFieldDefinition::create('entity_reference')
|
||||
|
@ -40,6 +40,9 @@ view published case entities:
|
||||
view unpublished case entities:
|
||||
title: 'View unpublished Case entities'
|
||||
|
||||
view unpublished actor entities:
|
||||
title: 'View unpublished Actor entities'
|
||||
|
||||
view all case revisions:
|
||||
title: 'View all Case revisions'
|
||||
|
||||
|
@ -240,11 +240,11 @@ class OCActivity extends RevisionableContentEntityBase implements OCActivityInte
|
||||
'weight' => -3,
|
||||
]);
|
||||
|
||||
// not currently in use. Will set view and form settings when ready
|
||||
$fields['status'] = BaseFieldDefinition::create('boolean')
|
||||
->setLabel(t('Publishing status'))
|
||||
->setDescription(t('A boolean indicating whether the Activity is published.'))
|
||||
->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)
|
||||
->setDisplayConfigurable('form', TRUE)
|
||||
->setDefaultValue(TRUE);
|
||||
|
||||
$fields['user_id'] = BaseFieldDefinition::create('entity_reference')
|
||||
|
@ -213,11 +213,11 @@ class OCActor extends RevisionableContentEntityBase implements OCActorInterface
|
||||
public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
|
||||
$fields = parent::baseFieldDefinitions($entity_type);
|
||||
|
||||
// Currently not using this, but will add form and view settings when ready.
|
||||
$fields['status'] = BaseFieldDefinition::create('boolean')
|
||||
->setLabel(t('Publishing status'))
|
||||
->setDescription(t('Whether this record is published.'))
|
||||
->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)
|
||||
->setDisplayConfigurable("form", true)
|
||||
->setDefaultValue(TRUE);
|
||||
|
||||
// The name gets set on preSave, from the first middle and last
|
||||
|
@ -167,7 +167,14 @@ class OCEvent extends ContentEntityBase implements OCEventInterface {
|
||||
->setDisplayConfigurable('view', TRUE)
|
||||
->setRequired(TRUE);
|
||||
|
||||
$fields['status']->setDescription(t('A boolean indicating whether the Event is published.'));
|
||||
$fields['status'] = BaseFieldDefinition::create('boolean')
|
||||
->setLabel(t('Publishing status'))
|
||||
->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)
|
||||
->setDisplayConfigurable("form", true)
|
||||
->setDefaultValue(TRUE);
|
||||
|
||||
|
||||
|
||||
$fields['created'] = BaseFieldDefinition::create('created')
|
||||
->setLabel(t('Created'))
|
||||
|
@ -456,7 +456,13 @@ class OCOrganisation extends EditorialContentEntityBase implements OCOrganisatio
|
||||
->setDisplayConfigurable('view', TRUE)
|
||||
->setRequired(TRUE);
|
||||
|
||||
$fields['status']->setDescription(t('A boolean indicating whether the Organisation is published.'));
|
||||
$fields['status'] = BaseFieldDefinition::create('boolean')
|
||||
->setLabel(t('Published'))
|
||||
->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)
|
||||
->setDisplayConfigurable("form", true)
|
||||
->setDefaultValue(TRUE);
|
||||
|
||||
|
||||
$fields['created'] = BaseFieldDefinition::create('created')
|
||||
->setLabel(t('Created'))
|
||||
|
@ -107,7 +107,7 @@ class OCOrganisationRelation extends ContentEntityBase implements OCOrganisation
|
||||
'max_length' => 50,
|
||||
'text_processing' => 0,
|
||||
])
|
||||
->setDefaultValue('Link between organisations')
|
||||
->setDefaultValue('Link')
|
||||
->setRequired(TRUE);
|
||||
|
||||
$fields['created'] = BaseFieldDefinition::create('created')
|
||||
|
@ -58,7 +58,11 @@ class OCActorForm extends ContentEntityForm {
|
||||
'%label' => $entity->label(),
|
||||
]));
|
||||
}
|
||||
$form_state->setRedirect('entity.oc_actor.canonical', ['oc_actor' => $entity->id()]);
|
||||
// If you have unpublished the entity and you can't see unpublished entities, redirect to a more informative message than just "Access Denied".
|
||||
if (!$form_state->getValue('status')['value'] && !\Drupal::currentUser()->hasPermission('view unpublished actor entities')) {
|
||||
$form_state->setRedirect('entity.node.canonical', ['node' => 1]);
|
||||
} else {
|
||||
$form_state->setRedirect('entity.oc_actor.canonical', ['oc_actor' => $entity->id()]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ class OCActorAccessControlHandler extends EntityAccessControlHandler {
|
||||
case 'view':
|
||||
if (!$entity->isPublished()) {
|
||||
return AccessResult::allowedIf(
|
||||
$account->hasPermission("view unpublished $bundle entities")
|
||||
$account->hasPermission("view unpublished actor entities")
|
||||
);
|
||||
}
|
||||
return AccessResult::allowedIf(
|
||||
|
@ -98,6 +98,20 @@ function opencase_uninstall() {
|
||||
}
|
||||
|
||||
function opencase_views_pre_render($view) {
|
||||
if (!empty($view->result)) {
|
||||
foreach ($view->result as $key => $result) {
|
||||
if (empty($result->_entity)) {
|
||||
continue;
|
||||
}
|
||||
$access = \Drupal::entityTypeManager()
|
||||
->getAccessControlHandler($result->_entity->getEntityTypeId())
|
||||
->access($result->_entity, 'view', NULL, TRUE);
|
||||
|
||||
if (!$access->isAllowed()) {
|
||||
unset($view->result[$key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (empty($view->result) && empty($view->exposed_input)) {
|
||||
$view->exposed_widgets = NULL;
|
||||
}
|
||||
@ -121,7 +135,6 @@ function opencase_entity_field_access($operation, \Drupal\Core\Field\FieldDefini
|
||||
function opencase_form_alter(&$form, &$form_state, $form_id) {
|
||||
if (preg_match('/oc_organisation_relation_.*_delete_form/', $form_id) or (preg_match('/oc_organisation_relation_.*_add_form/', $form_id))) {
|
||||
$form['actions']['submit']['#submit'][] = '_opencase_organisation_relation_redirect';
|
||||
// $form['actions']['cancel']['#url'] = $form_state->getFormObject()->getEntity()->toUrl();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,6 @@ class EntityReferenceCurrentTargetExcluder extends EntityReferenceLabelFormatter
|
||||
foreach($items as $delta=>$item) {
|
||||
$current_org = \Drupal::routeMatch()->getParameter('oc_organisation')->id();
|
||||
$item_target_id = $item->get('target_id')->getValue();
|
||||
\Drupal::logger("foo")->error($current_org . " " . $item_target_id);
|
||||
if ($current_org == $item_target_id) {
|
||||
$items->removeItem($delta);
|
||||
break;
|
||||
|
Reference in New Issue
Block a user