<?php
/**
  * Ahead WebSoft Technologies Pvt Ltd.
  * @copyright  Copyright 2006-2026 Ahead WebSoft Technologies Pvt Ltd.
  * @license    https://www.socialengine.com/policies
*/

class Core_Plugin_Menus
{
  /**
   * Controls visibility of the "Saved Items" menu entry in Core_Minimenu_Quick.
   * Hides the menu item when:
   * - The feature toggle (savecollection.enabled) is OFF
   * - The user is not authenticated (guest)
   *
   * @return bool
   */
  public function canViewSaveditems()
  {
    // Check feature is enabled
    if (!Engine_Api::_()->getApi('settings', 'core')->getSetting('savecollection.enabled', 1)) {
      return false;
    }

    // Check viewer is authenticated
    $viewer = Engine_Api::_()->user()->getViewer();
    if (!$viewer || !$viewer->getIdentity()) {
      return false;
    }

    return true;
  }
}
