Changed max length of full name, and some other things

This commit is contained in:
naomi 2021-02-08 21:28:15 +00:00
parent 9646e216aa
commit 7a995060ce
6 changed files with 16 additions and 7 deletions

View File

@ -34,7 +34,7 @@ function template_preprocess_oc_activity(array &$variables) {
$variables['other_fields'] = array();
foreach (Element::children($variables['elements']) as $key) {
$variables['content'][$key] = $variables['elements'][$key];
if (in_array($key, ['activity_date_time', 'time_taken', 'description', 'user_id'])) {
if (in_array($key, ['activity_date_time', 'time_taken', 'description', 'user_id', 'actors_involved'])) {
$variables['base_fields'][$key] = $variables['elements'][$key];
} else {
$variables['other_fields'][$key] = $variables['elements'][$key];

View File

@ -85,7 +85,8 @@ class OCActivity extends RevisionableContentEntityBase implements OCActivityInte
public static function currentDateTime() {
$current_time = DrupalDateTime::createFromTimestamp(time());
$formatted = $current_time->format(DateTimeItem::DATETIME_STORAGE_FORMAT);
$formatted = $current_time->format('Y-m-d');
error_log($formatted);
return $formatted;
}
/**
@ -222,11 +223,16 @@ class OCActivity extends RevisionableContentEntityBase implements OCActivityInte
->setRevisionable(TRUE)
->setRequired(TRUE)
->setDefaultValueCallback('\Drupal\opencase_entities\Entity\OCActivity::currentDateTime')
->setDisplayConfigurable('form', true)
->setDisplayConfigurable('view', true)
->setSettings([
'datetime_type' => 'date'
])
->setDisplayOptions('view', [
'label' => 'above',
'type' => 'datetime_default',
'settings' => [
'format_type' => 'medium',
'format_type' => 'short',
],
'weight' => -3,
])

View File

@ -248,7 +248,7 @@ class OCActor extends RevisionableContentEntityBase implements OCActorInterface
->setLabel(t('Name'))
->setRevisionable(TRUE)
->setSettings([
'max_length' => 20,
'max_length' => 50,
'text_processing' => 0,
])
->setDisplayConfigurable("form", true)

View File

@ -19,6 +19,7 @@
<h2>{{ title }}</h2>
<div class="oc_entity">
<div class="left">
{{ base_fields.actors_involved }}
{{ base_fields.activity_date_time }}
{{ base_fields.description }}
{{ base_fields.time_taken }}

View File

@ -36,8 +36,8 @@ function opencase_no_cases_entity_base_field_info($entity_type) {
->setCardinality(-1)
->setDisplayOptions('form', [
'label' => 'above',
'type' => 'entity_reference_autocomplete',
'weight' => -2,
'type' => 'hidden',
'weight' => -100,
'settings' => [
'match_operator' => 'CONTAINS',
'size' => '60',
@ -47,6 +47,7 @@ function opencase_no_cases_entity_base_field_info($entity_type) {
])
->setDisplayOptions('view', [
'label' => 'above',
'weight' => -100,
])
->setDefaultValueCallback('opencase_no_cases_actors_involved_callback')
->setRequired(TRUE);

View File

@ -23,7 +23,8 @@ class ContextualMenu extends BlockBase {
*/
public function build() {
$route_name = \Drupal::routeMatch()->getRouteName();
if ($route_name == 'entity.oc_actor.canonical') {
if ($route_name == 'entity.oc_actor.canonical' && \Drupal::routeMatch()->getParameter('oc_actor')->bundle() == 'client' ) {
;
$markup = $this->actorPage();
$build = [];
$build['contextual_menu'] = [