Astra_Ext_Nav_Widget_Support::get_widgets_by_id( int $menu_item_id )

Get widgets for menu item.


Description


Parameters

$menu_item_id

(int) (Required) menu item ID.


Return

(array)


Source

File: addons/nav-menu/classes/class-astra-ext-nav-widget-support.php

		public function get_widgets_by_id( $menu_item_id ) {

			$widgets     = array();
			$all_widgets = $this->get_ast_sidebar_widgets();

			if ( ! empty( $all_widgets ) ) {
				foreach ( $all_widgets as $widget_id ) {

					$settings = $this->get_settings_for_widget_id( $widget_id );

					if ( isset( $settings['ast_mm_parent_menu_id'] ) && $settings['ast_mm_parent_menu_id'] == $menu_item_id ) {

						$name = $this->get_name_for_widget_id( $widget_id );

						$widgets[ $widget_id ] = array(
							'id'    => $widget_id,
							'type'  => 'widget',
							'title' => $name,
						);
					}
				}
			}

			return $widgets;
		}

Changelog

Changelog
Version Description
1.6.0 Introduced.


User Contributed Notes

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