setStyle() public method

public setStyle ( array $style )
$style array
Example #1
0
 /**
  * Data can be set over by array.
  *
  * @param Collection $collection
  * @param array      $data
  *
  * @return Collection
  */
 protected function setDataToCollection(Collection $collection, $data)
 {
     // set parent
     if (!empty($data['parent'])) {
         $collectionEntity = $this->collectionRepository->findCollectionById($data['parent']);
         $collection->setParent($this->getApiEntity($collectionEntity, $data['locale']));
         // set parent
     } else {
         $collection->setParent(null);
         // is collection in root
     }
     // set other data
     foreach ($data as $attribute => $value) {
         if ($value) {
             switch ($attribute) {
                 case 'title':
                     $collection->setTitle($value);
                     break;
                 case 'description':
                     $collection->setDescription($value);
                     break;
                 case 'style':
                     $collection->setStyle($value);
                     break;
                 case 'type':
                     if (!isset($value['id'])) {
                         break;
                     }
                     $type = $this->getTypeById($value['id']);
                     $collection->setType($type);
                     break;
                 case 'changer':
                     $collection->setChanger($value);
                     break;
                 case 'creator':
                     $collection->setCreator($value);
                     break;
                 case 'properties':
                     $collection->setProperties($value);
                     break;
             }
         }
     }
     return $collection;
 }