Skip to main content
Bounty Ended with 25 reputation awarded by CommunityBot
added 157 characters in body
Source Link
Yuseferi
  • 22.2k
  • 22
  • 118
  • 218

After checking youyour module provided for me on git, I fix it withgithub and some reverse-engineering I find out the problem is on create('datetime') and you should use create('created') So the following code

$fields['date'] = BaseFieldDefinition::create('created')
  ->setLabel(t('DateTime'))
  ->setDescription(t('Date and time.'))
  ->setDisplayOptions('view', array(
    'label' => 'above',
    'type' => 'timestamp',
    'weight' => -4,
  ))
  ->setDisplayOptions('form', array(
    'type' => 'datetime_timestamp',
    'weight' => -4,
  ))
  ->setDisplayConfigurable('form', TRUE)
  ->setDisplayConfigurable('view', TRUE);

and get following resultsResults the below image for me. it seems it's Ok now.

enter image description here

After checking you module provided for me on git, I fix it with

$fields['date'] = BaseFieldDefinition::create('created')
  ->setLabel(t('DateTime'))
  ->setDescription(t('Date and time.'))
  ->setDisplayOptions('view', array(
    'label' => 'above',
    'type' => 'timestamp',
    'weight' => -4,
  ))
  ->setDisplayOptions('form', array(
    'type' => 'datetime_timestamp',
    'weight' => -4,
  ))
  ->setDisplayConfigurable('form', TRUE)
  ->setDisplayConfigurable('view', TRUE);

and get following results

enter image description here

After checking your module provided for me on github and some reverse-engineering I find out the problem is on create('datetime') and you should use create('created') So the following code

$fields['date'] = BaseFieldDefinition::create('created')
  ->setLabel(t('DateTime'))
  ->setDescription(t('Date and time.'))
  ->setDisplayOptions('view', array(
    'label' => 'above',
    'type' => 'timestamp',
    'weight' => -4,
  ))
  ->setDisplayOptions('form', array(
    'type' => 'datetime_timestamp',
    'weight' => -4,
  ))
  ->setDisplayConfigurable('form', TRUE)
  ->setDisplayConfigurable('view', TRUE);

Results the below image for me. it seems it's Ok now.

enter image description here

added 408 characters in body
Source Link
Yuseferi
  • 22.2k
  • 22
  • 118
  • 218

Try to setAfter checking you module provided for me on git, I fix it with

$fields['date'] = BaseFieldDefinition::create('created')
  ->setLabel(t('DateTime'))
  ->setDescription(t('Date and time.'))
  ->setDisplayOptions('view', array(
    'label' => 'hidden''above',
    'type' => 'timestamp',
    'weight' => 0-4,
  ))
  ->setDisplayOptions('form', array(
    'type' => 'datetime_timestamp',
    'weight' => 10-4,
  ))
  ->setDisplayConfigurable('form', TRUE)
  ->setDisplayConfigurable('view', TRUE);

and get following results

enter image description here

Try to set

  ->setDisplayOptions('view', array(
    'label' => 'hidden',
    'type' => 'timestamp',
    'weight' => 0,
  ))
  ->setDisplayOptions('form', array(
    'type' => 'datetime_timestamp',
    'weight' => 10,
  ))

After checking you module provided for me on git, I fix it with

$fields['date'] = BaseFieldDefinition::create('created')
  ->setLabel(t('DateTime'))
  ->setDescription(t('Date and time.'))
  ->setDisplayOptions('view', array(
    'label' => 'above',
    'type' => 'timestamp',
    'weight' => -4,
  ))
  ->setDisplayOptions('form', array(
    'type' => 'datetime_timestamp',
    'weight' => -4,
  ))
  ->setDisplayConfigurable('form', TRUE)
  ->setDisplayConfigurable('view', TRUE);

and get following results

enter image description here

added 118 characters in body
Source Link
Yuseferi
  • 22.2k
  • 22
  • 118
  • 218

Try to set

  ->setDisplayOptions('view', array(
    'label' => 'above''hidden',
    'type' => 'timestamp',
    'weight' => 0,
  ))
  -4>setDisplayOptions('form', array(
    'type' => 'datetime_timestamp',
    'weight' => 10,
  ))

Try to set

  ->setDisplayOptions('view', array(
    'label' => 'above',
    'type' => 'timestamp',
    'weight' => -4,
  ))

Try to set

  ->setDisplayOptions('view', array(
    'label' => 'hidden',
    'type' => 'timestamp',
    'weight' => 0,
  ))
  ->setDisplayOptions('form', array(
    'type' => 'datetime_timestamp',
    'weight' => 10,
  ))
added 106 characters in body
Source Link
Yuseferi
  • 22.2k
  • 22
  • 118
  • 218
Loading
Source Link
Yuseferi
  • 22.2k
  • 22
  • 118
  • 218
Loading