View Source Bonfire.Common.Modularity.DeclareHelpers (Bonfire v0.9.11-social-beta.6)

Helpers for declaring the existence of an extension (i.e., so it gets included in extension settings and nav).

Summary

Functions

Gets the OTP app name for a module

Declares an extension by setting up the module with the given name and options.

Generates a map representing a link with metadata for the extension with the given name, module, and options.

Functions

app(module)

Gets the OTP app name for a module

declare_extension(name, opts \\ [])

(macro)

Declares an extension by setting up the module with the given name and options.

Examples

iex> defmodule MyExtension do
...>   import Bonfire.Common.Modularity.DeclareHelpers
...>   declare_extension("My Extension", readme: "MY_README.md")
...> end

generate_link(name, module, opts)

Generates a map representing a link with metadata for the extension with the given name, module, and options.

Examples

iex> Bonfire.Common.Modularity.DeclareHelpers.generate_link(:bonfire_common, Bonfire.Common, href: "/my_extension")
%{
  name: :bonfire_common,
  module: Bonfire.Common,
  app: :bonfire_common,
  href: "/my_extension",
  type: :link
}