if (!($this->handler instanceof IMenuPageHandler)) {
throw new ImplementationException(\get_class($this->handler), IMenuPageHandler::class);
}
+
+ $this->handler->setMenuItem($this);
}
}
namespace wcf\system\page\handler;
+use wcf\data\menu\item\MenuItem;
+
/**
* Default implementation for pages supporting visibility and outstanding items.
*
*/
abstract class AbstractMenuPageHandler implements IMenuPageHandler
{
+ /**
+ * @since 6.1
+ */
+ private MenuItem $menuItem;
+
/**
* @inheritDoc
*/
public function cacheObject(int $objectID): void
{
}
+
+ /**
+ * @inheritDoc
+ */
+ public function setMenuItem(MenuItem $menuItem): void
+ {
+ $this->menuItem = $menuItem;
+ }
+
+ /**
+ * @inheritDoc
+ */
+ public function getMenuItem(): MenuItem
+ {
+ return $this->menuItem;
+ }
}
namespace wcf\system\page\handler;
+use wcf\data\menu\item\MenuItem;
+
/**
* Default interface for pages supporting visibility and outstanding items.
*
* @since 6.0
*/
public function cacheObject(int $objectID): void;
+
+ /**
+ * Sets the menu item of this handler.
+ * This is intended to allow the handler to react to information from the MenuItem.
+ *
+ * @since 6.1
+ */
+ public function setMenuItem(MenuItem $menuItem): void;
+
+ /**
+ * @since 6.1
+ */
+ public function getMenuItem(): MenuItem;
}