I'm quite new to drupal so bear with me here.
I've created an entity using Drupal Console, specifically using
drupal generate:entity:content. Which works perfect. Kudos to the drupal console guys.
This specific entity will deal with adding some meta tags on specific URLs thru the site.
It has several fields which need to be completed:
keywords(if any), one open graph tag and a tag value.
After looking thru this question I've decided that using
hook_page_attachments is the way to go for me.
The logic for adding the tags is quite simple:
- Get the entity.
$entity = \Drupal::entityTypeManager()->getStorage('meta_tag_entity')
- Grab the current url.
- Loop thru the entity
urlfields and check if any matches the current url.
- If it does, simply add the tags.
And that's it.
The problem boils down this.
After I've loaded the entity (
$entity = \Drupal::entityTypeManager()->getStorage('meta_tag_entity')) I have no idea how to grab all the
I've looked over this question but it's not quite what I'm looking for.