lib/scrivito/attribute_deserializer.rb in scrivito_sdk-1.0.0 vs lib/scrivito/attribute_deserializer.rb in scrivito_sdk-1.1.0.rc1
- old
+ new
@@ -39,25 +39,25 @@
StringTagging.tag_as_html(attribute_value || '')
end
def deserialize_link_value(attribute_value)
return unless attribute_value
- if attribute_value['destination']
+ if attribute_value['obj_id']
deserialize_internal_link(attribute_value)
else
deserialize_external_link(attribute_value)
end
end
def deserialize_linklist_value(link_definitions)
if link_definitions.present?
link_definitions = link_definitions.map(&:with_indifferent_access)
- object_ids = link_definitions.map { |link_data| link_data[:destination] }.compact.uniq
+ object_ids = link_definitions.map { |link_data| link_data[:obj_id] }.compact.uniq
objects = object_ids.empty? ? [] : workspace.objs.find(object_ids)
link_definitions.each_with_object([]) do |link_data, links|
- obj = objects.detect { |o| o && o.id == link_data[:destination] }
+ obj = objects.detect { |o| o && o.id == link_data[:obj_id] }
link = Link.new(link_data.merge(obj: obj))
links << link if link.resolved?
end
else
[]
@@ -80,10 +80,10 @@
attribute_value ? workspace.objs.find(attribute_value).compact : []
end
def deserialize_internal_link(attribute_value)
Link.new(attribute_value.slice('title', 'query', 'fragment', 'target').symbolize_keys
- .merge(obj: workspace.objs.find(attribute_value['destination'])))
+ .merge(obj: workspace.objs.find(attribute_value['obj_id'])))
rescue ResourceNotFound
end
def deserialize_external_link(attribute_value)
Link.new(attribute_value.slice('url', 'title', 'target').symbolize_keys)