/** * Create article type if does not exist * * @param string $typeName * @return ArticleType */ private function getArticleType($typeName) { $requiredFields = array('guid' => 'text', 'version' => 'text', 'urgency' => 'text', 'copyright' => 'text', 'provider' => 'text', 'description' => 'body', 'dateline' => 'text', 'byline' => 'text', 'creditline' => 'text', 'inlinecontent' => 'body'); $type = new \ArticleType($typeName); if (!$type->exists()) { $type->create(); } $missingFields = array_diff(array_keys($requiredFields), $this->getFieldNames($type)); foreach ($missingFields as $fieldName) { $field = new \ArticleTypeField($type->getTypeName(), $fieldName); $field->create($requiredFields[$fieldName]); } return $type; }
if (!$valid) { $correct = false; $errorMsgs[] = getGS('The $1 field may only contain letters and underscore (_) character.', '</B>' . getGS('Name') . '</B>'); } } if ($correct) { $articleType = new ArticleType($f_name); if ($articleType->exists()) { $correct = false; $errorMsgs[] = getGS('The article type $1 already exists.', '<B>'.htmlspecialchars($f_name).'</B>'); } if ($correct) { $created = $articleType->create(); camp_html_goto_page("/$ADMIN/article_types/fields/add.php?f_article_type=$f_name"); } } $crumbs = array(); $crumbs[] = array(getGS("Configure"), ""); $crumbs[] = array(getGS("Article Types"), "/$ADMIN/article_types/"); $crumbs[] = array(getGS("Adding new article type"), ""); echo camp_html_breadcrumbs($crumbs); ?> <P> <TABLE BORDER="0" CELLSPACING="0" CELLPADDING="8" class="message_box"> <TR>