setAttributes() public method

Set the attributes of this item.
public setAttributes ( array $values )
$values array
示例#1
0
 private function processDraftIfPost(ItemInterface $item)
 {
     $attributes = array_replace(['draft' => false], $item->getAttributes());
     if (is_bool($attributes['draft']) === false) {
         throw new AttributeValueException('Invalid value. Expected boolean.', 'draft', $item->getPath(ItemInterface::SNAPSHOT_PATH_RELATIVE));
     }
     if ($item->getCollection() === 'posts' && $attributes['draft'] === true) {
         if ($this->processDraft === false) {
             $attributes['output'] = false;
             $item->setAttributes($attributes);
         }
     }
 }