Properties

$modelFactory

$modelFactory : \Charcoal\Factory\FactoryInterface

Store the factory instance for the current class.

Type

\Charcoal\Factory\FactoryInterface

$collectionLoader

$collectionLoader : \Charcoal\Loader\CollectionLoader

Store the collection loader for the current class.

Type

\Charcoal\Loader\CollectionLoader

$adminConfig

$adminConfig : object

Type

object — The admin config object model.

$currentPage

$currentPage : integer

Type

integer — The current Page.

$numPerPage

$numPerPage : integer

Type

integer — News by page.

$numPages

$numPages : integer

Type

integer — How many pages.

$entryCycle

$entryCycle : boolean

Type

boolean — Does the pager can cycle indefinitely.

$page

$page : integer

Type

integer

$category

$category : integer

Type

integer

$archive

$archive : array<mixed,\Charcoal\Cms\NewsInterface>

Type

array<mixed,\Charcoal\Cms\NewsInterface> — The archive news collection.

$objType

$objType : object

Type

object — The news object model.

$featIdent

$featIdent : string

Type

string — The config ident for featured news.

$featList

$featList : array<mixed,\Charcoal\Cms\NewsInterface>

Type

array<mixed,\Charcoal\Cms\NewsInterface> — The config ident for featured news.

$categoryItem

$categoryItem : array

Type

array

Methods

__construct()

__construct(array  $data) 

NewsManager constructor.

Parameters

array $data

The Data.

Throws

\Exception

When $data index is not set.

modelFactory()

modelFactory() : \Charcoal\Factory\FactoryInterface

Retrieve the object model factory.

Throws

\RuntimeException

If the model factory was not previously set.

Returns

\Charcoal\Factory\FactoryInterface

collectionLoader()

collectionLoader() : \Charcoal\Loader\CollectionLoader

Retrieve the model collection loader.

Throws

\RuntimeException

If the collection loader was not previously set.

Returns

\Charcoal\Loader\CollectionLoader

setAdminConfig()

setAdminConfig(mixed  $adminConfig) : self

Parameters

mixed $adminConfig

The admin configuration.

Returns

self

adminConfig()

adminConfig() : mixed

Returns

mixed

entries()

entries() : mixed

To be displayed news list.

Returns

mixed —

The news collection.

entriesLoader()

entriesLoader() : \Charcoal\Loader\CollectionLoader

Returns

\Charcoal\Loader\CollectionLoader

entry()

entry(integer|null  $id = null) : mixed

Parameters

integer|null $id

The news id.

Returns

mixed

all()

all() : array<mixed,\Charcoal\Cms\NewsInterface>|\Charcoal\Model\Collection

All available news.

Returns

array<mixed,\Charcoal\Cms\NewsInterface>|\Charcoal\Model\Collection —

The news collection.

loadCategoryItems()

loadCategoryItems() : array<mixed,\Charcoal\Object\CategoryInterface>|\Charcoal\Model\Collection

Returns

array<mixed,\Charcoal\Object\CategoryInterface>|\Charcoal\Model\Collection —

The category collection.

categoryItem()

categoryItem(integer  $id) : \Charcoal\Object\CategoryInterface

Parameters

integer $id

The category id.

Returns

\Charcoal\Object\CategoryInterface

featList()

featList(array  $options = array()) : mixed

Parameters

array $options

The options for the collection loader.

Throws

\Exception

When featured news ident is not valid.

Returns

mixed

archive()

archive() : array<mixed,\Charcoal\Cms\NewsInterface>|\Charcoal\Model\Collection

Returns

array<mixed,\Charcoal\Cms\NewsInterface>|\Charcoal\Model\Collection

latest()

latest() : \Charcoal\Cms\NewsInterface|array

Get the latest news.

Returns

\Charcoal\Cms\NewsInterface|array —

The latest news.

prev()

prev() : mixed

Returns

mixed —

The previous news

next()

next() : mixed

Returns

mixed —

The next news

currentPage()

currentPage() : float|integer

Returns

float|integer —

The current news index page ident.

currentNews()

currentNews() : mixed

Returns

mixed

numPerPage()

numPerPage() : integer

Returns

integer

entryCycle()

entryCycle() : boolean

Returns

boolean

numNews()

numNews() : integer

Amount of news (total)

Returns

integer —

How many news?

numPages()

numPages() : float

The total amount of pages.

Returns

float

hasPager()

hasPager() : boolean

Is there a pager.

Returns

boolean

page()

page() : integer

Returns

integer

category()

category() : integer

Returns

integer

objType()

objType() : mixed

Returns

mixed

featIdent()

featIdent() : mixed

Returns

mixed

setCurrentNews()

setCurrentNews(mixed  $currentNews) : self

Parameters

mixed $currentNews

The current news context.

Returns

self —

.

setNumPerPage()

setNumPerPage(integer  $numPerPage) : self

Parameters

integer $numPerPage

The number of news per page.

Returns

self

setEntryCycle()

setEntryCycle(boolean  $entryCycle) : self

Parameters

boolean $entryCycle

Next and Prev cycles indefinitely.

Returns

self

setPage()

setPage(integer  $page) : self

Parameters

integer $page

The page number to load.

Returns

self

setCategory()

setCategory(integer  $category) : self

Parameters

integer $category

The current news category.

Returns

self

setObjType()

setObjType(mixed  $objType) : self

Parameters

mixed $objType

The object type.

Returns

self

setFeatIdent()

setFeatIdent(mixed  $featIdent) : self

Parameters

mixed $featIdent

The featured list ident.

Returns

self

setPrevNext()

setPrevNext() : $this

Set the Prev and Next news

Returns

$this

setModelFactory()

setModelFactory(\Charcoal\Factory\FactoryInterface  $factory) : self

Set an object model factory.

Parameters

\Charcoal\Factory\FactoryInterface $factory

The model factory, to create objects.

Returns

self

setCollectionLoader()

setCollectionLoader(\Charcoal\Loader\CollectionLoader  $loader) : self

Set a model collection loader.

Parameters

\Charcoal\Loader\CollectionLoader $loader

The collection loader.

Returns

self