See https://community.woltlab.com/thread/291999-men%C3%BCpunkt-verschwindet-wenn-%C3%BCbergeordneter-men%C3%BCpunkt-der-gleiche-ist/
<option value="0">{lang}wcf.global.noSelection{/lang}</option>
{foreach from=$menuItemNodeList item=menuItemNode}
- <option value="{@$menuItemNode->itemID}"{if $menuItemNode->itemID == $parentItemID} selected{/if}>{if $menuItemNode->getDepth() > 1}{@" "|str_repeat:($menuItemNode->getDepth() - 1)}{/if}{$menuItemNode->getTitle()}</option>
+ <option
+ value="{@$menuItemNode->itemID}"
+ {if $menuItemNode->itemID == $parentItemID} selected{/if}
+ {if $menuItemNode->itemID == $itemID} disabled{/if}
+ >
+ {if $menuItemNode->getDepth() > 1}{@" "|str_repeat:($menuItemNode->getDepth() - 1)}{/if}{$menuItemNode->getTitle()}
+ </option>
{/foreach}
</select>
{if $errorField == 'parentItemID'}
use wcf\data\page\PageNodeTree;
use wcf\form\AbstractForm;
use wcf\system\exception\IllegalLinkException;
+use wcf\system\exception\UserInputException;
use wcf\system\language\I18nHandler;
use wcf\system\page\handler\ILookupPageHandler;
use wcf\system\WCF;
}
}
+ /**
+ * @inheritDoc
+ */
+ public function validate()
+ {
+ parent::validate();
+
+ if ($this->parentItemID == $this->itemID) {
+ throw new UserInputException('parentItemID');
+ }
+ }
+
/**
* @inheritDoc
*/