Xpressengine\Document\Models\Document::fixedAttributes PHP Method

fixedAttributes() public method

Set default value to attributes
public fixedAttributes ( array $attributes ) : array
$attributes array attributes
return array
    public function fixedAttributes(array $attributes)
    {
        $attributes['pureContent'] = $this->getPureContent($attributes['content']);
        if (empty($attributes['userType']) === true) {
            $attributes['userType'] = $this::USER_TYPE_USER;
        }
        if (empty($attributes['approved']) === true) {
            $attributes['approved'] = $this::APPROVED_APPROVED;
        }
        if (empty($attributes['published']) === true) {
            $attributes['published'] = $this::PUBLISHED_PUBLISHED;
        }
        if (empty($attributes['status']) === true) {
            $attributes['status'] = $this::STATUS_PUBLIC;
        }
        if (empty($attributes['display']) === true) {
            $attributes['display'] = $this::DISPLAY_VISIBLE;
        }
        if ($attributes['published'] == 'published' && empty($attributes['publishedAt']) === true) {
            $attributes['publishedAt'] = $this->freshTimestamp();
        }
        if (empty($attributes['reply']) === true) {
            $attributes['reply'] = '';
        }
        if (empty($attributes['locale']) === true) {
            $attributes['locale'] = '';
        }
        return $attributes;
    }