added country name to sapi index
This commit is contained in:
@@ -70,6 +70,7 @@ function materio_sapi_preprocess_fieldset(&$variables) {
|
||||
|
||||
|
||||
// ? https://happyculture.coop/blog/drupal-8-declarer-un-champ-extrafield-calcule-computed-field
|
||||
// ? https://fivejars.com/blog/entity-basefielddefinitions-fields-examples-drupal-8
|
||||
/**
|
||||
* Implements hook_entity_bundle_field_info().
|
||||
*/
|
||||
@@ -86,8 +87,25 @@ function materio_sapi_entity_bundle_field_info(\Drupal\Core\Entity\EntityTypeInt
|
||||
->setClass('\Drupal\materio_sapi\ThesaurusRefComputed')
|
||||
->setDisplayConfigurable('view', FALSE);
|
||||
}
|
||||
}
|
||||
$fields["field_country_name_computed"] = \Drupal\Core\Field\BaseFieldDefinition::create('string')
|
||||
->setLabel(t("Country Name"))
|
||||
->setComputed(TRUE)
|
||||
->setTranslatable(TRUE)
|
||||
->setClass('\Drupal\materio_sapi\CountryNameNodeComputed')
|
||||
->setDisplayConfigurable('view', FALSE);
|
||||
}
|
||||
}
|
||||
// if ($entity_type->id() == 'taxonomy_term') {
|
||||
// if ($bundle == 'company') {
|
||||
// $fields["field_country_name_computed"] = \Drupal\Core\Field\BaseFieldDefinition::create('string')
|
||||
// ->setName('field_country_name_computed')
|
||||
// ->setLabel(t("Country Name"))
|
||||
// ->setComputed(TRUE)
|
||||
// ->setTranslatable(TRUE)
|
||||
// ->setClass('\Drupal\materio_sapi\CountryNameComputed')
|
||||
// ->setDisplayConfigurable('view', FALSE);
|
||||
// }
|
||||
// }
|
||||
return $fields;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user