PHP Class Mlp_Nav_Menu_Frontend

Show file Open project: inpsyde/multilingual-press

Public Methods

Method Description
__construct ( string $meta_key, Mlp_Language_Api_Interface $language_api ) Constructor.
filter_items ( array $items ) : WP_Post[] Filters the nav menu items.
maybe_delete_obsolete_item ( WP_Post $item ) : boolean Checks if the site with the given post's remote site ID still exists, and deletes the post if not.

Private Methods

Method Description
get_item_details ( array $translations, integer $site_id ) : array Returns the remote URL and the translation object for the according item.
get_site_id ( WP_Post $item ) : integer Returns the site ID for the given nav menu item object.
prepare_item ( WP_Post $item, array $translations ) : void Assigns the remote URL and fires an action hook.

Method Details

__construct() public method

Constructor.
public __construct ( string $meta_key, Mlp_Language_Api_Interface $language_api )
$meta_key string The site ID meta key.
$language_api Mlp_Language_Api_Interface The language API.

filter_items() public method

Filters the nav menu items.
public filter_items ( array $items ) : WP_Post[]
$items array Nav menu items.
return WP_Post[]

maybe_delete_obsolete_item() public method

Checks if the site with the given post's remote site ID still exists, and deletes the post if not.
public maybe_delete_obsolete_item ( WP_Post $item ) : boolean
$item WP_Post Nav menu item.
return boolean