Class: Fiona7::AttributeWriters::WidgetlistAsLinklist
- Inherits:
-
AttributeWriter
- Object
- AttributeWriter
- Fiona7::AttributeWriters::WidgetlistAsLinklist
- Defined in:
- lib/fiona7/attribute_writers/widgetlist_as_linklist.rb
Instance Method Summary collapse
Methods inherited from AttributeWriter
Constructor Details
This class inherits a constructor from Fiona7::AttributeWriters::AttributeWriter
Instance Method Details
#call(value, claimed_type = nil) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/fiona7/attribute_writers/widgetlist_as_linklist.rb', line 6 def call(value, claimed_type=nil) # TODO: widget_respository links = [] if value.kind_of?(Array) (value || []).each do || if (path=self.[]||self.[.to_s]) links << {destination_object: path, title: } else raise Scrivito::ScrivitoError, "Inconsistent widget pool state detected, unable to store widgets (unable to find #{widget_id} in #{self.widget_map.inspect})" end end elsif value.kind_of?(Hash) # stupid shits could not use one consistent format (value || {})["list"].each do |crap| = crap["widget"] if (path=self.[]||self.[.to_s]) links << {destination_object: path, title: } else raise Scrivito::ScrivitoError, "Inconsistent widget pool state detected, unable to store widgets (unable to find #{widget_id} in #{self.widget_map.inspect})" end end end self.obj.set(self.attr_name, links) end |