NavMenuActions.php
8 years ago
NavMenuFrontEnd.php
8 years ago
NavMenuRemoveItem.php
9 years ago
NavMenuRepository.php
8 years ago
NavMenuSync.php
9 years ago
NavMenuSyncListing.php
8 years ago
NavMenuSyncMenu.php
8 years ago
NavMenuTrashActions.php
7 years ago
NavMenuSync.php
54 lines
| 1 | <?php |
| 2 | namespace NestedPages\Entities\NavMenu; |
| 3 | |
| 4 | use NestedPages\Entities\NavMenu\NavMenuRepository; |
| 5 | use NestedPages\Entities\PluginIntegration\IntegrationFactory; |
| 6 | |
| 7 | /** |
| 8 | * Base Nav Menu Sync class |
| 9 | */ |
| 10 | abstract class NavMenuSync |
| 11 | { |
| 12 | /** |
| 13 | * Nav Menu Repository |
| 14 | * @var object NavMenuRepository |
| 15 | */ |
| 16 | protected $nav_menu_repo; |
| 17 | |
| 18 | /** |
| 19 | * The Menu ID |
| 20 | * @var int |
| 21 | */ |
| 22 | protected $id; |
| 23 | |
| 24 | /** |
| 25 | * Plugin Integrations |
| 26 | * @var object |
| 27 | */ |
| 28 | protected $integrations; |
| 29 | |
| 30 | public function __construct() |
| 31 | { |
| 32 | $this->nav_menu_repo = new NavMenuRepository; |
| 33 | $this->integrations = new IntegrationFactory; |
| 34 | $this->setMenuID(); |
| 35 | } |
| 36 | |
| 37 | /** |
| 38 | * Menu ID Setter |
| 39 | */ |
| 40 | protected function setMenuID() |
| 41 | { |
| 42 | $this->id = $this->nav_menu_repo->getMenuID(); |
| 43 | } |
| 44 | |
| 45 | /** |
| 46 | * Remove a Menu Item |
| 47 | * @since 1.3.4 |
| 48 | * @param int $id - ID of nav menu item |
| 49 | */ |
| 50 | protected function removeItem($id) |
| 51 | { |
| 52 | wp_delete_post($id, true); |
| 53 | } |
| 54 | } |