Drupal 8 has term method loadproperties which works for custom fields; however, how can I use it (or can I use it) to load by substrings. For example if I have a field: field_full_name and I want to load all terms that start with a string "David*" is this possible ... if not how?

Thanks ~


You can use the SQL operator LIKE in an entity query and append the wildcard % to the string:

$result = \Drupal::entityQuery('taxonomy_term')
  ->condition('name', 'david%', 'LIKE')
  ->condition('vid', 'tags')

$terms = \Drupal::entityTypeManager()

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.