lib/scrivito/basic_widget.rb in scrivito_sdk-1.8.1 vs lib/scrivito/basic_widget.rb in scrivito_sdk-1.9.0.rc1
- old
+ new
@@ -2,11 +2,11 @@
# The CMS widget class. Widget classes let you create widget types for the individual kinds
# of content editors want to place on pages or into widgets. All widget classes are based on
# subclasses of {Scrivito::BasicWidget Widget}. As with CMS objects, the content of a widget
# is stored in its attributes.
-# @see http://scrivito.com/page-with-widgets Creating a page type with widgets
+# @see https://scrivito.com/page-with-widgets Creating a page type with widgets
# @api public
class BasicWidget
extend AttributeContent::ClassMethods
extend ::ActiveSupport::DescendantsTracker
include AttributeContent
@@ -202,26 +202,10 @@
attributes[attribute_name] = attribute_value
end
self.class.new(attributes)
end
- def copy_for_restore(referenced_ids)
- attributes = {}
- attribute_definitions.each do |attribute_definition|
- attribute_name = attribute_definition.name
- attribute_value = read_attribute(attribute_name)
- if attribute_definition.widgetlist?
- attribute_value = attribute_value
- .reject { |widget| referenced_ids.include?(widget.id) }
- .map { |widget| widget.copy_for_restore(referenced_ids) }
- end
- attributes[attribute_name] = attribute_value
- end
- attributes['_id'] = id
- self.class.new(attributes)
- end
-
def clone
raise "The method `clone' was removed. Please use `copy' instead"
end
def id
@@ -343,13 +327,9 @@
def container_field_name
Scrivito::Deprecation.warn('Scrivito::BasicWidget#container_field_name is deprecated'\
' and will be removed in a future version.'\
' Please use Scrivito::BasicWidget#container_attribute_name instead.')
container_attribute_name
- end
-
- def container_attribute_index
- container[container_attribute_name].index(self)
end
def has_attribute?(key)
key.to_s == '_obj_class' || super
end