PHP Class Xpressengine\Category\CategoryHandler

### app binding : xe.category 로 바인딩 되어 있음 Category Facade 로 접근 가능 ### 카테고리 생성 php 신규 카테고리 그룹 생성 $category = Category::create(); 카테고리 그룹에 아이템 추가 $item = Category::createItem($category, ['word' => '단어', 'description' => '설명']); 특정 단어의 하위 노드로 등록하고자 할땐 3번째 인자로 부모에 해당하는 아이템을 넘겨주면 됩니다. $child = Category::createItem($category, ['word' => '자식'], $item); ### 카테고리 사용 php 최상위 레벨 아이템 목록 $items = Category::progenitors($category); 특정 아이템의 하위 노드 아이템 목록 $item = array_shift($items); $_1depthItems = Category::children($item); 전체를 tree collection 으로 반환 받을수도 있습니다. php $category = Category::get($id); $tree = Category::getTree($category); ### 특정 대상과 카테고리 아이템의 연결 카테고리 패키지는 대상이 어떤 단어를 사용하는지에 대한 정보를 가지고 관리합니다. php 연결 Category::used($docId, $categoryItem); 해제 Category::unused($docId, $categoryItem);
Author: XE Team (developers) ([email protected])
Exibir arquivo Open project: xpressengine/xpressengine Class Usage Examples

Protected Properties

Property Type Description
$model string Model class

Public Methods

Method Description
create ( array $inputs ) : Category Create new category
createItem ( Category $category, array $inputs ) : CategoryItem Create a new category item
createItemModel ( Category $category = null ) : mixed Create new category item model
createModel ( ) : Category Create model instance
getModel ( ) : string The name of Category model class
moveTo ( CategoryItem $item, CategoryItem $parent = null ) : CategoryItem Move to another parent CategoryItem
put ( Category $category ) : Category Update category
putItem ( CategoryItem $item ) : CategoryItem Modify item information
remove ( Category $category ) : boolean Remove category
removeItem ( CategoryItem $item, boolean $force = true ) : boolean Remove single item or all descendant
setModel ( string $model ) : void Set the name of Category model

Protected Methods

Method Description
setHierarchy ( CategoryItem $item ) : void Set hierarchy information for new item

Method Details

create() public method

Create new category
public create ( array $inputs ) : Category
$inputs array attributes for created
return Xpressengine\Category\Models\Category

createItem() public method

Create a new category item
public createItem ( Category $category, array $inputs ) : CategoryItem
$category Xpressengine\Category\Models\Category category instance
$inputs array item attributes for created
return Xpressengine\Category\Models\CategoryItem

createItemModel() public method

Create new category item model
public createItemModel ( Category $category = null ) : mixed
$category Xpressengine\Category\Models\Category category instance
return mixed

createModel() public method

Create model instance
public createModel ( ) : Category
return Xpressengine\Category\Models\Category

getModel() public method

The name of Category model class
public getModel ( ) : string
return string

moveTo() public method

Move to another parent CategoryItem
public moveTo ( CategoryItem $item, CategoryItem $parent = null ) : CategoryItem
$item Xpressengine\Category\Models\CategoryItem item object
$parent Xpressengine\Category\Models\CategoryItem new parent item object
return Xpressengine\Category\Models\CategoryItem

put() public method

Update category
public put ( Category $category ) : Category
$category Xpressengine\Category\Models\Category category instance
return Xpressengine\Category\Models\Category

putItem() public method

Modify item information
public putItem ( CategoryItem $item ) : CategoryItem
$item Xpressengine\Category\Models\CategoryItem item object
return Xpressengine\Category\Models\CategoryItem

remove() public method

Remove category
public remove ( Category $category ) : boolean
$category Xpressengine\Category\Models\Category category instance
return boolean

removeItem() public method

Remove single item or all descendant
public removeItem ( CategoryItem $item, boolean $force = true ) : boolean
$item Xpressengine\Category\Models\CategoryItem item object
$force boolean if true then remove all descendant
return boolean

setHierarchy() protected method

Set hierarchy information for new item
protected setHierarchy ( CategoryItem $item ) : void
$item Xpressengine\Category\Models\CategoryItem item object
return void

setModel() public method

Set the name of Category model
public setModel ( string $model ) : void
$model string model class
return void

Property Details

$model protected_oe property

Model class
protected string $model
return string