lib/scrivito/link.rb in scrivito_sdk-0.65.2 vs lib/scrivito/link.rb in scrivito_sdk-0.66.0.rc1
- old
+ new
@@ -133,9 +133,21 @@
dt = obj.display_title if dt.blank? && !external?
dt = url if dt.blank?
dt
end
+ # The alt description of a +Link+ used for {ScrivitoHelper#scrivito_image_tag}.
+ #
+ # By default this method returns the +title+ of this +Link+.
+ # If +title+ is nil and this +Link+ references an {BasicObj Obj}
+ # +alt_description+ of that {BasicObj Obj} is used.
+ #
+ # @api public
+ def alt_description
+ return title if title
+ obj.alt_description if internal?
+ end
+
# Returns true this Link links to a CMS Object.
# @api public
def internal?
url.nil?
end