Skip to main content

Mega Menu — functions

21 public functions. 1 are 🔌 pluggable (function_exists()-guarded, so a theme/child can override them).

FunctionSummary
fw_ext_mega_menu_color_to_cssResolve a color value to a CSS color string. Prefers the shortcodes extension's sc_color_to_css() (compact preset picker → var(--color-{slug}) or custom hex); falls back to a self-contained resolver when that extension is inactive (values are then plain color-picker strings). Tolerates the legacy plain-hex shape either way, so no data migration is needed.
fw_ext_mega_menu_column_styleBuild the inline style for a MegaMenu column <li> (background color + image). Per-part escaped, concatenated raw (matches the row helper's usage).
fw_ext_mega_menu_get_db_item_optionGet item option value from the database
fw_ext_mega_menu_get_item_optionRead a single per-item option value (defined in options/{row,column,item,default}.php) saved through the "Settings" modal (FW_Db_Options_Model_MegaMenu).
fw_ext_mega_menu_get_metaReturns a mega menu meta value for a post, falling back to the given default.
fw_ext_mega_menu_groupWrap a set of options in a border-less group container (house style), keyed by a distinct group id. Container-only — leaf ids and saved values are unchanged.
fw_ext_mega_menu_icon_is_setIs an icon value (icon-v2 array, or a legacy class string) actually set?
fw_ext_mega_menu_icon_optionsThe shared Icon + Icon Position options, added to every per-item options set (row / column / item / default) so the icon is edited inside the "Settings" modal instead of the old standalone control.
fw_ext_mega_menu_is_mm_itemCheck if menu item is a MegaMenu item or is inside a MegaMenu item
fw_ext_mega_menu_item_iconThe icon VALUE for a menu item — the modern per-item option (icon-v2) when set, otherwise the legacy mega-menu[id][icon] class string saved by the old standalone "Edit Icon" control. Returns null when there is no icon.
fw_ext_mega_menu_item_typeThe per-item options type for a menu item, by its MegaMenu level: 1 = row (top trigger), 2 = column, 3+ = item, 0 = default (non-mega item).
fw_ext_mega_menu_link_target_attrNew-tab attributes for a URL that points off-site (mirrors the tag_list shortcode convention). Returns ' target="_blank" rel="noopener noreferrer"' for external links, '' for internal/relative ones.
fw_ext_mega_menu_render_column_contentRender a MegaMenu column's custom content (Column Content = image / content / widget / raw), for the walker_nav_menu_start_el filter. Returns '' for the default "links" type (or empty payload) so the sub-menu renders normally.
fw_ext_mega_menu_render_iconRender a menu item's icon to HTML. Prefers the shortcodes extension's sc_icon_render() (font / emoji / svg / image, FA4→FA6 normalized); falls back to a plain font <i> for a class string when that extension is inactive.
fw_ext_mega_menu_row_container_styleBuild the inline style string for a MegaMenu row (dropdown panel) container.
fw_ext_mega_menu_set_db_item_optionSet item option value in database
fw_ext_mega_menu_update_metaUpdates mega menu meta for a post from the given key-value array.
fw_mega_menu_get_metaDeprecated alias for fw_ext_mega_menu_get_meta(); reads a mega-menu meta value with a fallback default.
fw_mega_menu_name_metaDeprecated alias building the admin input name attribute for a mega-menu meta key.
fw_mega_menu_request_metaDeprecated alias returning the submitted POST values for a mega-menu item.
fw_mega_menu_update_metaDeprecated alias for fw_ext_mega_menu_update_meta(); writes mega-menu meta from the given array.

fw_ext_mega_menu_color_to_css

fw_ext_mega_menu_color_to_css($value, $fallback = '')

Resolve a color value to a CSS color string. Prefers the shortcodes extension's sc_color_to_css() (compact preset picker → var(--color-{slug}) or custom hex); falls back to a self-contained resolver when that extension is inactive (values are then plain color-picker strings). Tolerates the legacy plain-hex shape either way, so no data migration is needed.

ParameterTypeDescription
$valuemixedstring|array from a color-picker / compact preset field
$fallbackstringreturned when nothing usable is set

Returns string

Source: framework/extensions/megamenu/helpers.php:255

fw_ext_mega_menu_column_style

fw_ext_mega_menu_column_style($column_id)

Build the inline style for a MegaMenu column <li> (background color + image). Per-part escaped, concatenated raw (matches the row helper's usage).

ParameterTypeDescription
$column_idint

Returns string '' when nothing to apply

Source: framework/extensions/megamenu/helpers.php:280

fw_ext_mega_menu_get_db_item_option

🔌 pluggable

fw_ext_mega_menu_get_db_item_option($item, $option_id = null, $default_value = null)

Get item option value from the database

ParameterTypeDescription
$itemint
$option_idstring|null'type/option_id' (accepts multikey). null - all options
$default_valuenull|mixedIf no option found in the database, this value will be returned

Returns mixed\|null

Source: framework/extensions/megamenu/helpers.php:525

fw_ext_mega_menu_get_item_option

fw_ext_mega_menu_get_item_option($item, $type, $option_id = null, $default = null)

Read a single per-item option value (defined in options/{row,column,item,default}.php) saved through the "Settings" modal (FW_Db_Options_Model_MegaMenu).

ParameterTypeDescription
$itemint|WP_Post
$typestringOne of 'row' | 'column' | 'item' | 'default'
$option_idstring|nullLeaf option id, or null for the whole type group
$defaultmixed

Returns mixed

Source: framework/extensions/megamenu/helpers.php:31

fw_ext_mega_menu_get_meta

fw_ext_mega_menu_get_meta($post, $key, $default = null)

Returns a mega menu meta value for a post, falling back to the given default.

Source: framework/extensions/megamenu/helpers.php:12

fw_ext_mega_menu_group

fw_ext_mega_menu_group($group_id, array $options)

Wrap a set of options in a border-less group container (house style), keyed by a distinct group id. Container-only — leaf ids and saved values are unchanged.

ParameterTypeDescription
$group_idstring
$optionsarray

Returns array single-entry array: { <group_id>: { type:group, options } }

Source: framework/extensions/megamenu/helpers.php:240

fw_ext_mega_menu_icon_is_set

fw_ext_mega_menu_icon_is_set($val)

Is an icon value (icon-v2 array, or a legacy class string) actually set?

ParameterTypeDescription
$valmixed

Returns bool

Source: framework/extensions/megamenu/helpers.php:96

fw_ext_mega_menu_icon_options

fw_ext_mega_menu_icon_options()

The shared Icon + Icon Position options, added to every per-item options set (row / column / item / default) so the icon is edited inside the "Settings" modal instead of the old standalone control.

Returns array

Source: framework/extensions/megamenu/helpers.php:172

fw_ext_mega_menu_is_mm_item

fw_ext_mega_menu_is_mm_item($item)

Check if menu item is a MegaMenu item or is inside a MegaMenu item

ParameterTypeDescription
$itemWP_Post

Returns bool

Source: framework/extensions/megamenu/helpers.php:385

fw_ext_mega_menu_item_icon

fw_ext_mega_menu_item_icon($item)

The icon VALUE for a menu item — the modern per-item option (icon-v2) when set, otherwise the legacy mega-menu[id][icon] class string saved by the old standalone "Edit Icon" control. Returns null when there is no icon.

The returned value is fed straight to sc_icon_render() (which accepts both the icon-v2 array and a legacy string), so no per-type branching is needed here.

ParameterTypeDescription
$itemint|WP_Post

Returns array\|string\|null

Source: framework/extensions/megamenu/helpers.php:124

fw_ext_mega_menu_item_type

fw_ext_mega_menu_item_type($item)

The per-item options type for a menu item, by its MegaMenu level: 1 = row (top trigger), 2 = column, 3+ = item, 0 = default (non-mega item).

ParameterTypeDescription
$itemint|WP_Post

Returns string one of 'row' | 'column' | 'item' | 'default'

Source: framework/extensions/megamenu/helpers.php:82

fw_ext_mega_menu_link_target_attr($url)

New-tab attributes for a URL that points off-site (mirrors the tag_list shortcode convention). Returns ' target="_blank" rel="noopener noreferrer"' for external links, '' for internal/relative ones.

ParameterTypeDescription
$urlstring

Returns string

Source: framework/extensions/megamenu/helpers.php:308

fw_ext_mega_menu_render_column_content

fw_ext_mega_menu_render_column_content($item, $type)

Render a MegaMenu column's custom content (Column Content = image / content / widget / raw), for the walker_nav_menu_start_el filter. Returns '' for the default "links" type (or empty payload) so the sub-menu renders normally.

ParameterTypeDescription
$itemint|WP_PostColumn menu item
$typestringOne of 'image' | 'content' | 'widget' | 'raw'

Returns string

Source: framework/extensions/megamenu/helpers.php:329

fw_ext_mega_menu_render_icon

fw_ext_mega_menu_render_icon($item, $extra_class = '')

Render a menu item's icon to HTML. Prefers the shortcodes extension's sc_icon_render() (font / emoji / svg / image, FA4→FA6 normalized); falls back to a plain font <i> for a class string when that extension is inactive.

ParameterTypeDescription
$itemint|WP_Post
$extra_classstringextra class on the rendered icon

Returns string

Source: framework/extensions/megamenu/helpers.php:142

fw_ext_mega_menu_row_container_style

fw_ext_mega_menu_row_container_style($row_id)

Build the inline style string for a MegaMenu row (dropdown panel) container.

ParameterTypeDescription
$row_idintTop-level MegaMenu item id

Returns string Escaped CSS, or '' when nothing to apply

Source: framework/extensions/megamenu/helpers.php:49

fw_ext_mega_menu_set_db_item_option

fw_ext_mega_menu_set_db_item_option( $item, $option_id, $value )

Set item option value in database

ParameterTypeDescription
$itemint
$option_idstring|null'type/option_id' (accepts multikey). null - all options
$value

Source: framework/extensions/megamenu/helpers.php:556

fw_ext_mega_menu_update_meta

fw_ext_mega_menu_update_meta($post, array $array)

Updates mega menu meta for a post from the given key-value array.

Source: framework/extensions/megamenu/helpers.php:17

fw_mega_menu_get_meta

fw_mega_menu_get_meta($post, $key, $default = null)

Deprecated alias for fw_ext_mega_menu_get_meta(); reads a mega-menu meta value with a fallback default.

Source: framework/extensions/megamenu/includes/deprecated-functions.php:13

fw_mega_menu_name_meta

⚠️ deprecated

fw_mega_menu_name_meta($post, $key)

Deprecated alias building the admin input name attribute for a mega-menu meta key.

ParameterTypeDescription
$post
$key

Returns string

Source: framework/extensions/megamenu/includes/deprecated-functions.php:37

fw_mega_menu_request_meta

⚠️ deprecated

fw_mega_menu_request_meta($post)

Deprecated alias returning the submitted POST values for a mega-menu item.

ParameterTypeDescription
$post

Returns array

Source: framework/extensions/megamenu/includes/deprecated-functions.php:48

fw_mega_menu_update_meta

⚠️ deprecated

fw_mega_menu_update_meta($post, array $array)

Deprecated alias for fw_ext_mega_menu_update_meta(); writes mega-menu meta from the given array.

ParameterTypeDescription
$post
$arrayarray

Returns mixed

Source: framework/extensions/megamenu/includes/deprecated-functions.php:25

← Back to Functions overview