Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
Nodes, comments, taxonomy terms, and users, in the terminology used since Drupal 7, are generally called "entities."
0
votes
0
answers
85
views
Query condition with entity referenced via custom field
We have the usual way to reference related tables through JOINs using:
$query->condition('foo.entity:type.bar', $value);
But how can this be specified when foo is not a direct field but a complex cus …
0
votes
2
answers
43
views
Getting existing fields in hook_entity_bundle_field_info()
I have custom fields that I need to add to specific entity types and bundles with hook_entity_bundle_field_info(). However, I have to decide on which one to add depending on already existing fields, h …
0
votes
Getting existing fields in hook_entity_bundle_field_info()
I found the core field module to use a direct entity query approach like:
$ids = \Drupal::entityQuery('field_config')
->condition('id', $entity_type->id() . '.' . $bundle . '.', 'STARTS_WITH')
->e …
0
votes
1
answer
60
views
hook_entity_bundle_field_info_alter() cannot call entity_display.repository's getViewModes()
Somewhat the continuation of Getting existing fields in hook_entity_bundle_field_info() with a similar problem. I'm using this hook now to make modifications not only to the bundle fields but their fo …
0
votes
0
answers
82
views
Changing content type description doesn't work
I have a new Drupal 8 site (single, non-English language, I have a hunch this plays some part in the problem). After installation, I changed the description of the two prefabricated content types (Art …
1
vote
1
answer
1k
views
Validation on custom entity edit form
I have a custom entity where, instead of using the usual way of specifying edit form options with setDisplayOptions('form' and relying on ContentEntityForm to create my edit form for me, I have to mak …
2
votes
Accepted
Dependent Dropdown in Field Widget
You didn't deserve the downvote: this is a perfectly good question, one that has simply no answer anywhere on the web yet. All of them only speak about dependent dropdowns in forms, not custom fields …
0
votes
Default value for datetime field definition in content entity?
In addition to the answer of CallMarl, mentioning that you should use another data type instead, the actual proper way to initialize any data of your custom entity, including not only timestamps but a …
4
votes
2
answers
981
views
Can I create non-default EntityReferenceSelection?
query = parent::buildEntityQuery($match, $match_operator);
$query->condition('id', $this->getAllowedIds(), 'IN');
return $query;
}
public function validateReferenceableNewEntities(array $entities … ) {
$entities = parent::validateReferenceableNewEntities($entities);
$allowed = $this->getAllowedIds();
return array_filter($entities, function ($entity) {
return in_array($entity->id …
3
votes
Accepted
Can I create non-default EntityReferenceSelection?
Update
I needed it again, this time already in Drupal 10. The old tricks are no longer necessary, it works without the deriver and the extra key now.
Earlier
Finally, after some investigation, two req …
3
votes
How to add filters to a custom entity type listing page
In your entity list builder, you have a getEntityIds() that's responsible for loading the entities. You probably didn't override it at all to get the full list. …
0
votes
1
answer
67
views
Field without Used in data in Fields Report
I had several fields on content that had an empty Used in in /admin/reports/fields. Apart from being inelegant :-), it's a real problem because Views doesn't see them properly as belonging to content …
0
votes
Accepted
Field without Used in data in Fields Report
OK, I'm on the right track after a bit of sleuthing. Drupal\Core\Entity\EntityFieldManager::getFieldMap() reveals that the final knowledge comes from entity.definitions.bundle_field_map. I won't write …
0
votes
1
answer
131
views
Translatable custom entity
Was there any significant change in how translatable custom entities are updated leading up to Drupal 10.1? There are a few questions here that deal with the question but it no longer seems to work. …
2
votes
Translatable custom entity
Indeed, the items above are no longer sufficient, some others have to be specified as well:
$definition_update_manager = \Drupal::entityDefinitionUpdateManager();
$entity_type = $definition_update …