This project is not covered by Drupal’s security advisory policy.
This is a work in progress attempt to use a config-entity to define field-types that union together existing field types.
Kind of like paragraphs or field collection, without the extra entity.
Similar to multifield in D7, but backed by D8's typed-data.
See The readme for what is working and where you can help.
The tricky bits (the data-model) are done, the UI work (config entity UI, formatter, widget) is where the love is needed.
Example of the data-model.
$accepted = Term::create([
'vid' => $this->vocabulary->id(),
'name' => 'Accepted',
]);
$entity = EntityTest::create([
'name' => 'entity',
'applicant' => [
'first_name' => 'Jerry',
'surname' => 'Johnson',
'resume' => [
'uri' => 'http://example.com/jerry.johnson',
'title' => 'My resume',
],
'bio' => [
'value' => '<p>My bio<strong>is amazing!</strong></p><div>but divs are not allowed</div>',
'format' => 'filtered_html',
],
'category' => $accepted,
],
]);
$entity->save();
As you can see, you just specify the applicant data values using a nested-array.
Accessing the data is just as nice!
$entity->applicant->first_name->value; // Value would be 'Jerry'
$entity->applicant->surname->value; // Value would be 'Johnson'
$entity->applicant->surname = 'Smith'; // Update a value.
$entity->applicant->category->entity->id(); // Chain through entity-reference fields - value would be the term ID.
$entity->applicant->category->entity->label(); // Value would be 'Accepted'
$entity->applicant->resume->uri; // Works with multi-column fields - value would be 'http://example.com/jerry.johnson'
$entity->applicant->bio->processed; // And computed fields work too! - value would be '<p>My bio<strong>is amazing!</strong></p>but divs are not allowed'
Project information
- Minimally maintained
Maintainers monitor issues, but fast responses are not guaranteed. - Module categories: Site Structure
- Created by larowlan on , updated
- This project is not covered by the security advisory policy.
Use at your own risk! It may have publicly disclosed vulnerabilities.