コード例 #1
0
ファイル: PageArray.php プロジェクト: avatar382/fablab_site
 /**
  * Get the value of $property from $item
  *
  * Used by the WireArray::sort method to retrieve a value from a Wire object. 
  * If output formatting is on, we turn it off to ensure that the sorting
  * is performed without output formatting.
  *
  * @param Wire $item
  * @param string $property
  * @return mixed
  *
  */
 protected function getItemPropertyValue(Wire $item, $property)
 {
     if ($item instanceof Page) {
         $value = $item->getUnformatted($property);
     } else {
         if (strpos($property, '.') !== false) {
             $value = WireData::_getDot($property, $item);
         } else {
             if ($item instanceof WireArray) {
                 $value = $item->getProperty($property);
                 if (is_null($value)) {
                     $value = $item->first();
                     $value = $this->getItemPropertyValue($value, $property);
                 }
             } else {
                 $value = $item->{$property};
             }
         }
     }
     if (is_array($value)) {
         $value = implode('|', $value);
     }
     return $value;
 }