Module: Locomotive::Concerns::ContentType::Label

Included in:
Locomotive::ContentType
Defined in:
app/models/locomotive/concerns/content_type/label.rb

Instance Method Summary collapse

Instance Method Details

#label_field_id=(value) ⇒ Object



6
7
8
9
10
11
# File 'app/models/locomotive/concerns/content_type/label.rb', line 6

def label_field_id=(value)
  # update the label_field_name if the label_field_id is changed
  new_label_field_name = self.entries_custom_fields.where(_id: value).first.try(:name)
  self.label_field_name = new_label_field_name
  super(value)
end

#label_field_name=(value) ⇒ Object



13
14
15
16
17
# File 'app/models/locomotive/concerns/content_type/label.rb', line 13

def label_field_name=(value)
  # mandatory if we allow the API to set the label field name without an id of the field
  @new_label_field_name = value unless value.blank?
  super(value)
end