Brainstorm_Update_Astra_Addon::astra_addon_get_addon_usage()

Prepare Astra’s megamenu data to pass BSF-Analytics.


Description


Return

(void)


Source

File: class-brainstorm-update-astra-addon.php

		public function astra_addon_get_addon_usage() {

			$all_menus               = wp_get_nav_menus();
			$megamenu_analytics_data = array();

			if ( ! is_array( $all_menus ) && empty( $all_menus ) ) {
				return;
			}

			foreach ( $all_menus as $key => $menu_term ) {
				$menu_items = wp_get_nav_menu_items( $menu_term->term_id );
				foreach ( $menu_items as $menu_item ) {
					// Enable Megamenu.
					$is_enable = isset( $menu_item->megamenu ) ? $menu_item->megamenu : '';
					if ( 'megamenu' === $is_enable ) {
						$megamenu_analytics_data['megamenu-is-enabled'][] = 'yes';
					}

					// Width type.
					$width_type = isset( $menu_item->megamenu_width ) ? $menu_item->megamenu_width : '';
					if ( '' !== $width_type ) {
						$megamenu_analytics_data['menu-container-types'][] = $width_type;
					}

					// Content source.
					$content_source = isset( $menu_item->megamenu_content_src ) ? $menu_item->megamenu_content_src : '';
					if ( '' !== $content_source ) {
						$megamenu_analytics_data['sub-menus-content-source'][] = $content_source;
					}

					// Enabled heading.
					$enabled_heading = isset( $menu_item->megamenu_enable_heading ) ? $menu_item->megamenu_enable_heading : '';
					if ( '' !== $enabled_heading ) {
						$megamenu_analytics_data['sub-menus-heading-enabled'][] = $enabled_heading;
					}
				}
			}

			update_option( 'ast_extension_data', $megamenu_analytics_data );
		}

Changelog

Changelog
Version Description
3.9.3 Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.