コード例 #1
0
ファイル: Edit.php プロジェクト: bolt/bolt
 /**
  * Determine which templates will result in templatefields.
  *
  * @param ContentType $contentType
  * @param Content     $content
  *
  * @return array
  */
 private function getTemplateFieldTemplates(ContentType $contentType, Content $content)
 {
     $templateFieldTemplates = [];
     $templateFieldsConfig = $this->config->get('theme/templatefields');
     if ($templateFieldsConfig) {
         $templateFieldTemplates = array_keys($templateFieldsConfig);
         // Special case for default template
         $toRepair = [];
         foreach ($contentType['fields'] as $name => $field) {
             if ($field['type'] === 'templateselect' && !empty($content->values[$name])) {
                 $toRepair[$name] = $content->values[$name];
                 $content->set($name, '');
             }
         }
         if ($content->hasTemplateFields()) {
             $templateFieldTemplates[] = '';
         }
         foreach ($toRepair as $name => $value) {
             $content->set($name, $value);
         }
     }
     return $templateFieldTemplates;
 }