Example #1
0
function __label(Penelope\Property $property)
{
    $label = $property->getLabel();
    if ($property->getName() === $label) {
        $label = ucfirst(str_replace('_', ' ', $property->getName()));
    }
    __(_e($label));
}
Example #2
0
 private function loadProperties()
 {
     $this->got_properties = true;
     // Prefill with values from the server if available.
     if ($this->hasId() and !$this->client_object) {
         $this->fetch();
     }
     // Look up each property separately instead of using $object#getProperties.
     // That way the order of properties as defined on the schema is maintained :).
     foreach ($this->schema->getProperties() as $property_schema) {
         $property_name = $property_schema->getName();
         $property = new Property($property_schema);
         $this->properties[$property_name] = $property;
         if ($this->client_object and !is_null($value = $this->client_object->getProperty($property_name))) {
             $property->setSerializedValue($value);
         }
     }
 }