public function createContentWithPath($path, $fields, $contentType)
    {
        $contentsName = explode('/', $path);
        $currentPath = '';
        $location = '2';
        foreach ($contentsName as $name) {
            if ($name != end($contentsName)) {
                $location = $this->createContent('folder', ['name' => $name], $location);
            }
            if ($currentPath != '') {
                $currentPath .= '/';
            }
            $currentPath .= $name;
            $this->mapContentPath($currentPath);
        }
        $location = $this->createContent($contentType, $fields, $location);

        return $location;
    }
public function createContentWithPath($path, $fields, $contentType)
    {
        $contentsName = explode('/', $path);
        $currentPath = '';
        $location = '2';
        foreach ($contentsName as $name) {
            if ($name != end($contentsName)) {
                $location = $this->createContent('folder', ['name' => $name], $location);
            }
            if ($currentPath != '') {
                $currentPath .= '/';
            }
            $currentPath .= $name;
            $this->mapContentPath($currentPath);
        }
        $location = $this->createContent($contentType, $fields, $location);

        return $location;
    }
public function createContentWithPath ( $ path , $ fields , $ contentType ) { $ contentsName = explode ( '/' , $ path ) ; $ currentPath = '' ; $ location = '2' ; foreach ( $ contentsName as $ name ) { if ( $ name != end ( $ contentsName ) ) { $ location = $ this -> createContent ( 'folder' , [ 'name' => $ name ] , $ location ) ; } if ( $ currentPath != '' ) { $ currentPath .= '/' ; } $ currentPath .= $ name ; $ this -> mapContentPath ( $ currentPath ) ; } $ location = $ this -> createContent ( $ contentType , $ fields , $ location ) ; return $ location ; }
Creates and publishes a content at a given path.
Non-existing path items are created as folders named after the path element.

@param string $path The content path
@param array $fields
@param mixed $contentType The content type identifier

@return mixed location id of the created content
Creates and publishes a content at a given path . Non - existing path items are created as folders named after the path element .