Bolt\Storage\Migration\Export::checkContenttypeValid PHP Метод

checkContenttypeValid() публичный Метод

Check Contenttype requested exists.
public checkContenttypeValid ( string | array $contenttypeslugs = [] ) : Export
$contenttypeslugs string | array
Результат Export
    public function checkContenttypeValid($contenttypeslugs = [])
    {
        // If nothing is passed in, we assume we're using all conenttypes
        if (empty($contenttypeslugs)) {
            $this->contenttypes = $this->app['storage']->getContentTypes();
            if (empty($this->contenttypes)) {
                $this->setError(true)->setErrorMessage('This installation of Bolt has no contenttypes configured!');
            }
            return $this;
        }
        if (is_array($contenttypeslugs)) {
            foreach ($contenttypeslugs as $contenttypeslug) {
                return $this->checkContenttypeValid($contenttypeslug);
            }
        }
        $contenttype = $this->app['storage']->getContentType($contenttypeslugs);
        if (empty($contenttype)) {
            $this->setError(true)->setErrorMessage("The requested ContentType '{$contenttypeslugs}' doesn't exist!");
        } elseif (!isset($this->contenttypes[$contenttypeslugs])) {
            $this->contenttypes[] = $contenttypeslugs;
        }
        return $this;
    }