removeNodes() public static method

This function does not check about permissions, this is the responsibility of the caller!
public static removeNodes ( array $removeNodeIdList ) : array
$removeNodeIdList array Array of Node ID to remove
return array An array with operation status, always true
Example #1
0
             if ($count > 0) {
                 $hasChildren = true;
             }
         }
     }
     if ($hasChildren) {
         $http->setSessionVariable('CurrentViewMode', $viewMode);
         $http->setSessionVariable('DeleteIDArray', array_keys($removeList));
         $http->setSessionVariable('ContentNodeID', $nodeID);
         $http->setSessionVariable('ContentLanguage', $languageCode);
         return $module->redirectToView('removeobject');
     } else {
         if (eZOperationHandler::operationIsAvailable('content_removelocation')) {
             $operationResult = eZOperationHandler::execute('content', 'removelocation', array('node_list' => array_keys($removeList)), null, true);
         } else {
             eZContentOperationCollection::removeNodes(array_keys($removeList));
         }
     }
     return $module->redirectToView('view', array($viewMode, $redirectNodeID, $languageCode));
 } else {
     if ($http->hasPostVariable('EditButton')) {
         if ($http->hasPostVariable('ContentObjectID')) {
             $parameters = array($http->postVariable('ContentObjectID'));
             if ($http->hasPostVariable('ContentObjectVersion')) {
                 $parameters[] = $http->postVariable('ContentObjectVersion');
                 if ($http->hasPostVariable('ContentObjectLanguageCode')) {
                     $parameters[] = $http->postVariable('ContentObjectLanguageCode');
                 }
             } else {
                 if ($http->hasPostVariable('ContentObjectLanguageCode')) {
                     $languageCode = $http->postVariable('ContentObjectLanguageCode');
Example #2
0
// to do this the following must be true:
// - The total child count must be zero
// - There must be no object removal (i.e. it is the only node for the object)
if ($totalChildCount == 0) {
    $canRemove = true;
    foreach ($deleteResult as $item) {
        if ($item['object_node_count'] <= 1) {
            $canRemove = false;
            break;
        }
    }
    if ($canRemove) {
        if (eZOperationHandler::operationIsAvailable('content_removelocation')) {
            $operationResult = eZOperationHandler::execute('content', 'removelocation', array('node_list' => array_keys($deleteNodeIdArray), 'move_to_trash' => $moveToTrash), null, true);
        } else {
            eZContentOperationCollection::removeNodes(array_keys($deleteNodeIdArray));
        }
        if ($http->hasSessionVariable('RedirectURIAfterRemove') && $http->sessionVariable('RedirectURIAfterRemove')) {
            $Module->redirectTo($http->sessionVariable('RedirectURIAfterRemove'));
            $http->removeSessionVariable('RedirectURIAfterRemove');
            return $http->removeSessionVariable('RedirectIfCancel');
        } else {
            return $Module->redirectToView('view', array($viewMode, $contentNodeID, $contentLanguage));
        }
    }
}
$tpl = eZTemplate::factory();
$tpl->setVariable('reverse_related', $info['reverse_related_count']);
$tpl->setVariable('module', $Module);
$tpl->setVariable('moveToTrashAllowed', $moveToTrashAllowed);
// Backwards compatibility