Class: Campo::Plugins::Aria::Klass

Inherits:
Plugin
  • Object
show all
Defined in:
lib/campo/plugins/aria.rb

Overview

InstanceMethods

Instance Method Summary collapse

Methods inherited from Plugin

#afters, #befores

Methods included from Pluggable

#after_output, #before_output, #extras, #on_plugin, #plugged_in

Constructor Details

#initialize(opts = {}) ⇒ Klass

Returns a new instance of Klass.



70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/campo/plugins/aria.rb', line 70

def initialize( opts={} )
  
  # adds `describe` to Convenience, it's an easy way to get it where it needs to be
  # @private
  on_plugin do
      Campo::Base.send(:include, Campo::Plugins::Aria::InstanceMethods::Convenience)
  end
  
  # Adds the form role attribute to all fields before output.
  # @private
  before_output do |fields,options|
    fields.find_all{|x| x.kind_of? Campo::Form }.each do |form|
      form.attributes[:role] = "form" if form.attributes[:role].nil? || form.attributes[:role].empty?
    end
  end
end