Entity reference in Drupal 9 - drupal-8

I've been using entity reference and entity reference autofill to achieve the following in Drupal 7.
Content type A has a field with entity reference and some child fields related to it.
Content type B has entity reference lookup field (drop-down) which referes to the node Content Type A
autofills child data in the content type B.
Is there any possibility to do this with Drupal 8/9? I've searched everywhere and did not come across a module which does the same.
I have no knowledge in coding, so please let me know if you have any experience with modules or workarounds.
Shiyam K

Related

Dialogflow: How to identify a specific string?

How can Dialogflow get a specific string (login/id) in a phrase? I thought to create an Entity called "login" with all the logins as "synonyms".
Is it the best approach?
PS: I have more than 1500 logins/id and Dialogflow allows up to 200.
Thanks
According to the example in your comment, it seems you need to get the person's name.
Dialogflow offers a system Entity called #sys.person
#sys.person: Common given names, last names or their combinations
You can also extend system entities if you want to add values that do not exist:
Extend a system entity while annotating a training phrase:
From the intent page's training phrase section, you can extend a system entity while annotating a training phrase. If you manually annotate a training phrase part with an extendable system entity that does not include the selected value, you will be prompted to add this value to the system entity.
Extend a system entity from the entities page
From the entities page, you can extend a system entity by following
these steps:
Create an entity.
Use the name of the system entity you want to extend. For example: sys.color.
Provide entity entries using the values you want to extend the entity with.
If you are using the API to extend system entities, create system
entity extensions similar to how you create developer entities.
Provide the name of the system entity you wish to extend, and provide
the values you want to extend it with. If you attempt to extend a
system entity that is not extendable, you will receive an err

Difference between Embedded Entity and Entity using ancestor path on GCP Datastore

I couldn't understand the difference between Embedded Entity and Entity using ancestor path on GCP Datastore.
I could understand following things.
By using ancestor path, it can manage entities as different kind, but there's writing 1 times/sec limit.
Ancestor path makes Strong Consistency
But these things are same as using embedded entity.
So I'm confusing how to use embedded entity and ancestor path appropriately.
Now I'm developing a model for form like Google Form.
It can be added items freely, so I'm thinking using embedded entity named Item or create kind named Item and use Ancestor path for Form class.
The embedded "entity" is not a real entity, it's just a property inside the "container" entity in which it is embedded. From Embedded entities (emphasis mine):
You may sometimes find it convenient to embed one entity as a
property of another entity.
You still have the 1 write/sec limit for that "container" entity. And you cannot update just the embedded "entity", you have to update the entire "container" entity.
The embedded entity may appear strongly consistent, but only in the sense that it's consistent with the other data in the "container" entity (nothing special here, the same is true for any property inside an entity). It is still eventually consistent when it comes to making queries using its values. And you cannot make such queries inside transactions.
Entities tied by ancestry on the other hand are real, distinct entities, all being placed inside the same entity group. The entire entity group is subject to the 1 write/sec limit. Ancestor queries have a scope limited to the respective entity group, are strongly consistent can be done inside transactions.
If strong consistency is what you're after then you have to use the datastore ancestry to tie the respective entities together.
Otherwise you can use either the embedded entities or simply plain entities of a different kind and establish the relationships between entities using Key properties. See also E-commerce Product Categories in Google App Engine (Python)

Sitecore ItemID does it change from deployment to deployment?

I am new to Sitecore and have a basic question around this. When I create a Sitecore item a Unique ID is created for this item. Is it ok if I use this item ID in the code to hold a reference to it? Does this change from deployment to deployment?
If you actually "deploy" your items -using a package or serialization (tool)-, the ID will stay the same and you can keep a reference to it in your code.
It is a good coding practice however not to spread hard-coded guids (as that is what the ID actually is wrapping) around all over your code. So either bundle them somewhere in a piece of code that can easily be deployed without side-effects or put them in a configuration file (but again, bundle them and don't mix with other stuff).
If for some reason the item would be gone some day and you need to re-create it (meaning: the id is changed) or you just need it to point to a new one, you will be grateful that you did keep it somewhere separated ;)
This is Sitecore behaviour to have Sitecore ID like a GUID. It is a very good aproach. The ID of an item can be also use in your C# code
The ID class in Sitecore is used to identify all types of item in Sitecore i.e. content items, templates, media items etc. It is a wrapper around .NET's own System.Guid struct and has a property called Guid which returns a System.Guid. Internally Sitecore stores IDs in it's SQL Server database using the uniqueidentifier type.
For exemple a template is also an item and it has a unique ID. If it wasn't the same ID between environments you need to modify your code between environments.
Sitecore ItemID always remain unique. So If you publish the content from your CM server to CD server, Item ID will not change. You can use ItemID as this ensure even if you change the name, you still reference to right Sitecore Content Item.
It is recommended to use some kind of class and put the item id there and reference from there so that in future, if you ever need to change then you change it in one place.
Using directly GUID or any number value for that matter are kind of magic values and is always prone to bugs.
A quick answer is yes, an ID does not change during deployments, so you can hold a reference in your code.
Sitecore Item Id will not change from deployment to deployment, You can use this ID in your code like:
Creating a class holding IDs
Or maybe a configuration file

Using Glass on a multilingual sitecore site

I'm building a multilingual Sitecore site and using Glass Mapper as the ORM, but running into an issue when the sitecore item doesn't exist in a particular language.
Rather than having a null model being passed into the view which I could check, I'm getting:
The model item passed into the dictionary is of type 'Sitecore.Mvc.Presentation.RenderingModel', but this dictionary requires a model item of type 'foo'.
This exception is happening on the placeholder line rather than in the particular view.
Specifying a model against for each rendering seems to solve the issue for renderings where a datasource has been specified (although doing this results in a model having an instance but every property is blank). But if the data source is the regular context item I get the error:
Could not locate item containing model definition. Model path: /sitecore/layout/Models/foo
Any ideas?

How to look up the document library in its local sub site where used, rather than in the root site?

I have a content type that has a lookup field for a document library in its sub site. The content type is declared a site collection root level but I want the look up field to look up the document library in its local sub site where used. I deploy the content types using PowerShell and have used an event receiver to add the look up field. I can't however get it to reference the correct list, it only ever references the list at the root site collection.
How can I overwrite the look up list?
I avoid setting the List attribute in the Field element. I have had problems saving the site as a template when a custom Field has the List attribute set. But the other problem is that these properties are write-once. Better to leave it blank in the definition and then set it in the instance programmatically using SPFieldLookup.LookupWebId and SPFieldLookup.LookupList.