Newscoop\Entity\Article::setOnFrontPage PHP Метод

setOnFrontPage() публичный Метод

Sets the value of onFrontPage.
public setOnFrontPage ( string $onFrontPage = false ) : self
$onFrontPage string the on front page
Результат self
    public function setOnFrontPage($onFrontPage = false)
    {
        if (is_bool($onFrontPage) || is_int($onFrontPage)) {
            if ($onFrontPage) {
                $this->onFrontPage = 'Y';
            } else {
                $this->onFrontPage = 'N';
            }
            return $this;
        } elseif (is_string($onFrontPage)) {
            $this->onFrontPage = $onFrontPage;
        } else {
            $this->onFrontPage = 'N';
        }
        return $this;
    }

Usage Example

Пример #1
0
 /**
  * Update Article static properties
  *
  * @param Article $article
  * @param array   $attributes
  *
  * @return Article
  */
 private function updateArticleMeta($article, $attributes)
 {
     if (array_key_exists('name', $attributes)) {
         $article->setName($attributes['name']);
     }
     if (array_key_exists('comments_enabled', $attributes)) {
         $article->setCommentsEnabled($attributes['comments_enabled']);
     }
     if (array_key_exists('comments_locked', $attributes)) {
         $article->setCommentsLocked($attributes['comments_locked']);
     }
     if (array_key_exists('onFrontPage', $attributes)) {
         $article->setOnFrontPage($attributes['onFrontPage']);
     }
     if (array_key_exists('onSection', $attributes)) {
         $article->setOnSection($attributes['onSection']);
     }
     if (array_key_exists('keywords', $attributes)) {
         $article->setKeywords($attributes['keywords'] ? $attributes['keywords'] : '');
     }
     return $article;
 }
All Usage Examples Of Newscoop\Entity\Article::setOnFrontPage