student entity: added fields

parent 2a38c52b
.odd {
background: #dddddd;
color: red;
}
.editable {
align: center;
color: blue;
}
.not-editable {
align: center;
color: black;
}
......@@ -56,3 +56,38 @@ function eepal_update_8204() {
function eepal_update_8205() {
\Drupal::entityDefinitionUpdateManager()->applyUpdates();
}
/**
* Implements hook_update_N().
*/
function eepal_update_8206() {
\Drupal::entityDefinitionUpdateManager()->applyUpdates();
}
/**
* Implements hook_update_N().
*/
function eepal_update_8207() {
\Drupal::entityDefinitionUpdateManager()->applyUpdates();
}
/**
* Implements hook_update_N().
*/
function eepal_update_8208() {
\Drupal::entityDefinitionUpdateManager()->applyUpdates();
}
/**
* Implements hook_update_N().
*/
function eepal_update_8209() {
\Drupal::entityDefinitionUpdateManager()->applyUpdates();
}
/**
* Implements hook_update_N().
*/
function eepal_update_8210() {
\Drupal::entityDefinitionUpdateManager()->applyUpdates();
}
......@@ -40,7 +40,11 @@ public function __construct(EntityTypeManagerInterface $entityTypeManager, Query
$arrayToReturn = array();
foreach ($studentClasses as $studentClass) {
array_push($arrayToReturn, array($studentClass->get('name')->value, $studentClass->get('maxno')->value));
array_push($arrayToReturn,
array(
array('data' => $studentClass->get('name')->value, 'class' => 'not-editable'),
array('data' => markup("<input type='text'" . "value='" . $studentClass->get('maxno')->value . "'>"), 'class' => 'editable')
));
}
return array_values($arrayToReturn);
......
......@@ -283,6 +283,65 @@ class Student extends RevisionableContentEntityBase implements StudentInterface
->setDisplayConfigurable('form', TRUE)
->setDisplayConfigurable('view', TRUE);
$fields['surname'] = BaseFieldDefinition::create('string')
->setLabel(t('Surname'))
->setDescription(t('The surname of the Student entity.'))
->setRevisionable(TRUE)
->setSettings(array(
'max_length' => 100,
'text_processing' => 0,
))
->setDefaultValue('')
->setDisplayOptions('view', array(
'label' => 'above',
'type' => 'string',
'weight' => -4,
))
->setDisplayOptions('form', array(
'type' => 'string_textfield',
'weight' => -4,
))
->setDisplayConfigurable('form', TRUE)
->setDisplayConfigurable('view', TRUE);
$fields['address'] = BaseFieldDefinition::create('string')
->setLabel(t('Address'))
->setDescription(t('The address of the Student entity.'))
->setRevisionable(TRUE)
->setSettings(array(
'max_length' => 255,
'text_processing' => 0,
))
->setDefaultValue('')
->setDisplayOptions('view', array(
'label' => 'above',
'type' => 'string',
'weight' => -4,
))
->setDisplayOptions('form', array(
'type' => 'string_textfield',
'weight' => -4,
))
->setDisplayConfigurable('form', TRUE)
->setDisplayConfigurable('view', TRUE);
$fields['birthdate'] = BaseFieldDefinition::create('datetime')
->setLabel(t('Birth date'))
->setDescription(t('The birth date'))
->setSetting('datetime_type', 'date')
->setRequired(true)
->setDisplayOptions('view', array(
'label' => 'above',
'type' => 'string',
'weight' => -4,
))->setDisplayOptions('form', array(
'type' => 'string_textfield',
'weight' => -4,
))
->setDisplayConfigurable('form', TRUE)
->setDisplayConfigurable('view', TRUE);
$fields['status'] = BaseFieldDefinition::create('boolean')
->setLabel(t('Publishing status'))
->setDescription(t('A boolean indicating whether the Student is published.'))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment