getBaseColumns() public static method

Gets a list of the base columns that are hard-coded into all content types (rather than configured through contenttypes.yml).
public static getBaseColumns ( )
Beispiel #1
0
 /**
  * Check if a given name is a valid column, and if it can be used in queries.
  *
  * @param string  $name
  * @param array   $contenttype
  * @param boolean $allowVariants
  *
  * @return boolean
  */
 private function isValidColumn($name, $contenttype, $allowVariants = false)
 {
     $isValidColumn = false;
     if ($this->isMultiOrderQuery($name)) {
         $separatedOrders = $this->getOrderBys($name);
     } else {
         $separatedOrders = [$name];
     }
     //Loop through each term if multiple
     foreach ($separatedOrders as $index => $name) {
         $name = trim($name);
         // Strip the minus in '-title' if allowed.
         if ($allowVariants) {
             if (strlen($name) > 0 && $name[0] == "-") {
                 $name = substr($name, 1);
             }
             $name = $this->getFieldName($name);
         }
         // Check if the $name is in the contenttype's fields.
         if (isset($contenttype['fields'][$name])) {
             $isValidColumn = true;
         }
         if (in_array($name, Content::getBaseColumns())) {
             $isValidColumn = true;
         }
         // Repeating fields are handled differently so skip here
         if (isset($contenttype['fields'][$name]) && $contenttype['fields'][$name]['type'] == 'repeater') {
             $isValidColumn = false;
         }
         if (!$isValidColumn) {
             return false;
         }
     }
     return true;
 }
Beispiel #2
0
 /**
  * Check if a given name is a valid column, and if it can be used in queries.
  *
  * @param string  $name
  * @param array   $contenttype
  * @param boolean $allowVariants
  *
  * @return boolean
  */
 private function isValidColumn($name, $contenttype, $allowVariants = false)
 {
     // Strip the minus in '-title' if allowed.
     if ($allowVariants) {
         if (strlen($name) > 0 && $name[0] == "-") {
             $name = substr($name, 1);
         }
         $name = $this->getFieldName($name);
     }
     // Check if the $name is in the contenttype's fields.
     if (isset($contenttype['fields'][$name])) {
         return true;
     }
     if (in_array($name, Content::getBaseColumns())) {
         return true;
     }
     return false;
 }