I have 3 embeddables in a blog post. Does an embeddable get assigned any sort of instance identifier/guid assigned to it that I can access at runtime?
I have 3 embeddables in a blog post. Does an embeddable get assigned any sort of instance identifier/guid assigned to it that I can access at runtime?
I tried $core_v2_widget.UniqueId("video") and got back: embed-f0793d6903794a48ae75630d9fed7958_video
Is it same to strip out the embed- and "_video" if I just wanted a guid identifier for this embeddable?
Basically, is it fair to say I can execute the code and have a unique GUID for the life of the embeddable on the piece of content.
#set($key = $core_v2_widget.UniqueId("video")) #set($key = $core_v2_utility.Replace($key, "embed-","")) #set($key = $core_v2_utility.Replace($key, "_video","")) $core_v2_utility.ParseGuid($key)
The ID can change due to saving/versioning but does represent the current instance and will persist through reloads assuming no change related to versioning or copying. The ID you are extracting, while it is not guaranteed to be a GUID (it is currently but may not always be), will uniquely identify the embeddable.
Could you briefly elaborate on what a change related to versioning or copying would entail?
An ID is generated whenever there isn't one or the ID specified in the content is not currently related to that content item (by ContentTypeId / ContentId). So copying an embeddable from one post to another would result in the ID updating. So would publishing an article revision (since article revisions are content with unique IDs vs the published version of the article).
Ok, that makes sense.