PHP Class RainLab\Blog\Models\Category

Inheritance: extends Mode\Model, use trait October\Rain\Database\Traits\Validation, use trait October\Rain\Database\Traits\NestedTree
Show file Open project: rainlab/blog-plugin Class Usage Examples

Public Properties

Property Type Description
$belongsToMany
$implement
$rules * Validation
$table
$translatable Attributes that support translation, if available.

Protected Properties

Property Type Description
$guarded

Public Methods

Method Description
afterDelete ( )
beforeValidate ( )
getMenuTypeInfo ( string $type ) : array Handler for the pages.menuitem.getTypeInfo event.
getPostCountAttribute ( )
resolveMenuItem ( RainLab\Pages\Classes\MenuItem $item, string $url, Cms\Classes\Theme $theme ) : mixed Handler for the pages.menuitem.resolveItem event.
setUrl ( string $pageName, Cms\Classes\Controller $controller ) Sets the "url" attribute with a URL to this object

Protected Methods

Method Description
getCategoryPageUrl ( $pageCode, $category, $theme ) Returns URL of a category page.
listSubCategoryOptions ( )

Method Details

afterDelete() public method

public afterDelete ( )

beforeValidate() public method

public beforeValidate ( )

getCategoryPageUrl() protected static method

Returns URL of a category page.
protected static getCategoryPageUrl ( $pageCode, $category, $theme )

getMenuTypeInfo() public static method

Returns a menu item type information. The type information is returned as array with the following elements: - references - a list of the item type reference options. The options are returned in the ["key"] => "title" format for options that don't have sub-options, and in the format ["key"] => ["title"=>"Option title", "items"=>[...]] for options that have sub-options. Optional, required only if the menu item type requires references. - nesting - Boolean value indicating whether the item type supports nested items. Optional, false if omitted. - dynamicItems - Boolean value indicating whether the item type could generate new menu items. Optional, false if omitted. - cmsPages - a list of CMS pages (objects of the Cms\Classes\Page class), if the item type requires a CMS page reference to resolve the item URL.
public static getMenuTypeInfo ( string $type ) : array
$type string Specifies the menu item type
return array Returns an array

getPostCountAttribute() public method

listSubCategoryOptions() protected static method

protected static listSubCategoryOptions ( )

resolveMenuItem() public static method

Returns information about a menu item. The result is an array with the following keys: - url - the menu item URL. Not required for menu item types that return all available records. The URL should be returned relative to the website root and include the subdirectory, if any. Use the URL::to() helper to generate the URLs. - isActive - determines whether the menu item is active. Not required for menu item types that return all available records. - items - an array of arrays with the same keys (url, isActive, items) + the title key. The items array should be added only if the $item's $nesting property value is TRUE.
public static resolveMenuItem ( RainLab\Pages\Classes\MenuItem $item, string $url, Cms\Classes\Theme $theme ) : mixed
$item RainLab\Pages\Classes\MenuItem Specifies the menu item.
$url string Specifies the current page URL, normalized, in lower case The URL is specified relative to the website root, it includes the subdirectory name, if any.
$theme Cms\Classes\Theme Specifies the current theme.
return mixed Returns an array. Returns null if the item cannot be resolved.

setUrl() public method

Sets the "url" attribute with a URL to this object
public setUrl ( string $pageName, Cms\Classes\Controller $controller )
$pageName string
$controller Cms\Classes\Controller

Property Details

$belongsToMany public property

public $belongsToMany

$guarded protected property

protected $guarded

$implement public property

public $implement

$rules public property

* Validation
public $rules

$table public property

public $table

$translatable public property

Attributes that support translation, if available.
public $translatable