Class: WCC::Contentful::Model::MenuButton

Inherits:
WCC::Contentful::Model show all
Defined in:
lib/wcc/contentful/model/menu_button.rb

Direct Known Subclasses

MenuButton

Instance Method Summary collapse

Methods inherited from WCC::Contentful::Model

all_models, const_missing, find, register_for_content_type, registered?, registry

Methods included from Helpers

#constant_from_content_type, #content_type_from_constant, #content_type_from_raw, #shared_prefix

Methods included from WCC::Contentful::ModelValidators

#schema, transform_content_types_for_validation, #validate_field, #validate_fields, #validations

Instance Method Details

#hrefObject

Gets either the external link or the slug from the referenced page. Example usage: ‘<%= link_to button.title, button.href %>`



11
12
13
14
# File 'lib/wcc/contentful/model/menu_button.rb', line 11

def href
  return external_link if external_link
  link&.try(:slug) || link&.try(:url)
end