Magic Helper Methods¶
| Module: | share.process.components.magic_helpers |
|---|
Returns a magic variable representing output from a previous action.
Handles both normal outputs and lookups of dictionary values.
Decorator. Adds a
fieldentry to every parameter dictionary into_htmlresults.As opposed to
classandcss_class(which provide styling information),fieldwill specify the type of editing interface when editing is implemented.
Returns an appropriate magic variable dict.
Parameters: - value – dict of information about the variable
- var_type –
“Type” entry in
value, indicating whether the variable is:- Clipboard
- Ask Each Time
- Current Date
- Shortcut Input (from Share sheet)
- Output from other actions
- A named variable (from Set Variable or Add to Variable actions)
- ask_each_time – The text used when Ask Each Time is selected as an option.
- UUID_glyphs – Maps actions’ output UUIDs to their glyphs.
Side Note: function contains a Python implementation of JavaScript’s switch-case structure that I am quite proud of :). The
lambdastop Python from evaluating every possible outcome beforehand.
Wraps a given
valuein a magic-var dict for the django templater.Parameters: - glyph – icon to be displayed to the left of magic variables.
- UUID – UUID of the action that supplied the magic variable, if any.
- empty – determines whether CSS class
emptyshould be applied.emptygreys out the value, indicating that it was left blank.
Wraps a given
valuein a dict for the django templater.Parameters: - css_class – list of CSS classes to be applied to the variable.
- empty – determines whether CSS class
emptyshould be applied.emptygreys out the value, indicating that it was left blank.