public function delete(Model\ContainerInterface $container)
    {
        // Ensure not named / alone
        if ($container->isAlone() || $container->isNamed() || $container->isTitled()) {
            throw new InvalidOperationException(
                "The container can't be removed because it is named or the parent content does not have enough children."
            );
        }

        // Check if the container is not the only content container (a content must have at least one container).
        if (null === $content = $container->getContent()) {
            throw new InvalidOperationException(
                "The container does not belong to a content and therefore can't be removed."
            );
        }

        // Plugin remove
        $this->editor
            ->getContainerPlugin($container->getType())
            ->remove($container);

        $content->removeContainer($container);

        $this->editor
            ->getContentManager()
            ->fixContainersPositions($content);

        return $container;
    }
public function delete(Model\ContainerInterface $container)
    {
        // Ensure not named / alone
        if ($container->isAlone() || $container->isNamed() || $container->isTitled()) {
            throw new InvalidOperationException(
                "The container can't be removed because it is named or the parent content does not have enough children."
            );
        }

        // Check if the container is not the only content container (a content must have at least one container).
        if (null === $content = $container->getContent()) {
            throw new InvalidOperationException(
                "The container does not belong to a content and therefore can't be removed."
            );
        }

        // Plugin remove
        $this->editor
            ->getContainerPlugin($container->getType())
            ->remove($container);

        $content->removeContainer($container);

        $this->editor
            ->getContentManager()
            ->fixContainersPositions($content);

        return $container;
    }
public function delete ( Model \ ContainerInterface $ container ) { // Ensure not named / alone if ( $ container -> isAlone ( ) || $ container -> isNamed ( ) || $ container -> isTitled ( ) ) { throw new InvalidOperationException ( "The container can't be removed because it is named or the parent content does not have enough children." ) ; } // Check if the container is not the only content container (a content must have at least one container). if ( null === $ content = $ container -> getContent ( ) ) { throw new InvalidOperationException ( "The container does not belong to a content and therefore can't be removed." ) ; } // Plugin remove $ this -> editor -> getContainerPlugin ( $ container -> getType ( ) ) -> remove ( $ container ) ; $ content -> removeContainer ( $ container ) ; $ this -> editor -> getContentManager ( ) -> fixContainersPositions ( $ content ) ; return $ container ; }
Deletes the container.

@param Model\ContainerInterface $container

@return Model\ContainerInterface The removed container.
@throws InvalidOperationException
Deletes the container .