public getOrderCommands ( ) : array | ||
리턴 | array | of arrays with 2 fields: name of node to order before second name |
public function getOrderCommands()
{
if (!$this->originalNodesOrder) {
return array();
}
$reorders = NodeHelper::calculateOrderBefore($this->originalNodesOrder, $this->nodes);
$this->originalNodesOrder = null;
return $reorders;
}
/** * {@inheritDoc} */ public function reorderChildren(Node $node) { $reorders = $node->getOrderCommands(); if (count($reorders) == 0) { // should not happen but safe is safe return; } $body = ''; $path = $node->getPath(); foreach ($reorders as $child => $destination) { if (is_null($destination)) { $body .= ">{$path}/{$child} : #last\r"; } else { $body .= ">{$path}/{$child} : {$destination}#before\r"; } } $this->setJsopBody(trim($body)); }