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(); $variables['other_fields'] = array();
foreach (Element::children($variables['elements']) as $key) { foreach (Element::children($variables['elements']) as $key) {
$variables['content'][$key] = $variables['elements'][$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]; $variables['base_fields'][$key] = $variables['elements'][$key];
} else { } else {
$variables['other_fields'][$key] = $variables['elements'][$key]; $variables['other_fields'][$key] = $variables['elements'][$key];

View File

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

View File

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

View File

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

View File

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

View File

@ -23,7 +23,8 @@ class ContextualMenu extends BlockBase {
*/ */
public function build() { public function build() {
$route_name = \Drupal::routeMatch()->getRouteName(); $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(); $markup = $this->actorPage();
$build = []; $build = [];
$build['contextual_menu'] = [ $build['contextual_menu'] = [