Updated to ManiaLink v3

This commit is contained in:
Jocy Wolff
2017-03-25 18:40:15 +01:00
parent 1010c1db6b
commit 120a0e2169
133 changed files with 16194 additions and 8949 deletions

View File

@ -9,72 +9,90 @@ use FML\Types\Scriptable;
* Menu Element for the Menu Feature
*
* @author steeffeen <mail@steeffeen.com>
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder
* @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/
class MenuElement {
/*
* Protected properties
*/
protected $item = null;
protected $control = null;
class MenuElement
{
/**
* Create a new Menu Element
*
* @param Control $item (optional) Item Control in the Menu bar
* @param Control $control (optional) Toggled Menu Control
*/
public function __construct(Control $item = null, Control $control = null) {
if ($item !== null) {
$this->setItem($item);
}
if ($control !== null) {
$this->setControl($control);
}
}
/**
* @var Control $item Menu Item
*/
protected $item = null;
/**
* Set the Item Control
*
* @param Control $item Item Control in the Menu bar
* @return static
*/
public function setItem(Control $item) {
$item->checkId();
if ($item instanceof Scriptable) {
$item->setScriptEvents(true);
}
$this->item = $item;
return $this;
}
/**
* @var Control $control Menu Control
*/
protected $control = null;
/**
* Get the Item Control
*
* @return \FML\Controls\Control
*/
public function getItem() {
return $this->item;
}
/**
* Create a new Menu Element
*
* @api
* @param Control $item (optional) Item Control in the Menu bar
* @param Control $control (optional) Toggled Menu Control
*/
public function __construct(Control $item = null, Control $control = null)
{
if ($item) {
$this->setItem($item);
}
if ($control) {
$this->setControl($control);
}
}
/**
* Set the Menu Control
*
* @param Control $control Toggled Menu Control
* @return static
*/
public function setControl(Control $control) {
$this->control = $control->checkId();
return $this;
}
/**
* Get the Item Control
*
* @api
* @return Control
*/
public function getItem()
{
return $this->item;
}
/**
* Set the Item Control
*
* @api
* @param Control $item Item Control
* @return static
*/
public function setItem(Control $item)
{
$item->checkId();
if ($item instanceof Scriptable) {
$item->setScriptEvents(true);
}
$this->item = $item;
return $this;
}
/**
* Get the Menu Control
*
* @api
* @return Control
*/
public function getControl()
{
return $this->control;
}
/**
* Set the Menu Control
*
* @api
* @param Control $control Menu Control
* @return static
*/
public function setControl(Control $control)
{
$control->checkId();
$this->control = $control;
return $this;
}
/**
* Get the Menu Control
*
* @return \FML\Controls\Control
*/
public function getControl() {
return $this->control;
}
}