Method: Pageflow::HelpEntries#register

Defined in:
lib/pageflow/help_entries.rb

#register(name, options = {}) ⇒ Object

Add a section to the help dialog displayed in the editor.

Translation keys for the help entry are derived from its name by appending “.menu_item” and “.text”. Text is parsed as markdown.

Parameters:

  • name (String)

    Translation key prefix

  • options (Hash) (defaults to: {})

Options Hash (options):

  • :parent (String)

    Name of the parent help entry

  • :priority (Fixnum) — default: 10

    Entries with higher priority come first in the entry list.



20
21
22
23
24
25
26
27
28
# File 'lib/pageflow/help_entries.rb', line 20

def register(name, options = {})
  help_entry = HelpEntry.new(name, options)
  @help_entries_by_name[name] = help_entry

  collection = find_collection(options[:parent])

  collection << help_entry
  collection.sort_by! { |help_entry| -help_entry.priority }
end