Bolt\Storage\Entity\Content::getTemplatefields PHP Method

getTemplatefields() public method

public getTemplatefields ( )
    public function getTemplatefields()
    {
        return $this->templatefields ?: [];
    }

Usage Example

Example #1
0
File: Edit.php Project: bolt/bolt
 /**
  * Create a list of fields types used in regular, template and virtual fields.
  *
  * @param ContentType $contentType
  * @param Content     $content
  * @param array       $has
  *
  * @return array
  */
 private function getUsedFieldtypes(ContentType $contentType, Content $content, array $has)
 {
     $fieldtypes = ['meta' => true];
     if ($content->getTemplatefields() instanceof TemplateFields) {
         $templateFields = $content->getTemplatefields()->getContenttype()->getFields() ?: [];
     } else {
         $templateFields = [];
     }
     foreach ([$contentType['fields'], $templateFields] as $fields) {
         foreach ($fields as $field) {
             $fieldtypes[$field['type']] = true;
         }
         if ($field['type'] === 'repeater') {
             foreach ($field['fields'] as $rfield) {
                 $fieldtypes[$rfield['type']] = true;
             }
         }
     }
     if ($has['relations'] || $has['incoming_relations']) {
         $fieldtypes['relationship'] = true;
     }
     if ($has['taxonomy'] || is_array($contentType['groups']) && in_array('taxonomy', $contentType['groups'])) {
         $fieldtypes['taxonomy'] = true;
     }
     if ($has['templatefields'] || is_array($contentType['groups']) && in_array('template', $contentType['groups'])) {
         $fieldtypes['template'] = true;
     }
     return array_keys($fieldtypes);
 }
All Usage Examples Of Bolt\Storage\Entity\Content::getTemplatefields