Chuyển tới nội dung chính

Tag

Trang danh sách thẻ (tag)​

Module Thẻ có từ phiên bản 8.1.3. Xem tài liệu tính năng đầy đủ tại Thẻ (Tag).

Table columns​

Chỉnh sửa danh sách cột của bảng thẻ

HooksLoại HookPlatformVersion
manage_tag_columnsfiltercms8.1.3
$this->_column_headers = apply_filters('manage_tag_columns', array $columnHeaders);

Params:

  • $columnHeaders (array) : danh sách column

Return: $columnHeaders

Table columns action​

Tạo ra danh sách buttons cho column action

HooksLoại HookPlatformVersion
admin_tag_table_columns_actionfiltercms8.1.3
$buttons = apply_filters('admin_tag_table_columns_action', array $buttons, $item);

Params:

  • $buttons (array) : danh sách button
  • $item (object) : đối tượng thẻ của dòng hiện tại

Return: $buttons

View trang danh sách​

HooksLoại HookPlatformVersion
admin_tag_index_viewfiltercms8.1.3
return Cms::view(apply_filters('admin_tag_index_view', 'tag-index'));

Thêm & Cập nhật thẻ​

Form fields​

Thay đổi các group, các field trong form thêm/sửa thẻ

HooksLoại HookPlatformVersion
manage_tag_inputfiltercms8.1.3
return apply_filters('manage_tag_input', $form);

Params: $form — đối tượng Form

Return: $form

Điều kiện lấy thẻ ở trang sửa​

HooksLoại HookPlatformVersion
admin_tag_controllers_edit_argsfiltercms8.1.3
$query = apply_filters('admin_tag_controllers_edit_args', Tag::whereKey($id), $id);

Params:

  • $query (SkillDo\Database\Eloquent\Builder) : query lấy thẻ
  • $id (int) : id thẻ đang sửa

Return: $query

Đối tượng thẻ ở trang sửa​

HooksLoại HookPlatformVersion
admin_tag_controllers_edit_objectsfiltercms8.1.3
$object = apply_filters('admin_tag_controllers_edit_objects', $query->first(), $id);

View trang thêm / sửa​

HooksLoại HookPlatformVersion
admin_tag_add_viewfiltercms8.1.3
admin_tag_edit_viewfiltercms8.1.3
return Cms::view(apply_filters('admin_tag_add_view', 'tag-save'));
return Cms::view(apply_filters('admin_tag_edit_view', 'tag-save'));

Cột dữ liệu của model Tag​

HooksLoại HookPlatformVersion
columns_db_tagfiltercms8.1.3

Dùng để bổ sung cột cho model Tag.


Gắn thẻ vào nội dung​

Bật/tắt thẻ cho một post type​

HooksLoại HookPlatformVersion
tag_enabled_{tagType}filtercms8.1.3

Hook động — tên hook ghép theo post type.

$enabled = apply_filters('tag_enabled_'.$tagType, bool $enabled, string $tagType);

Danh sách thẻ của một đối tượng​

HooksLoại HookPlatformVersion
gets_tags_by_objectfiltercms8.1.3
return apply_filters('gets_tags_by_object', $query->get(), clone $query);

Sau khi đồng bộ thẻ​

HooksLoại HookPlatformVersion
tag_syncedactioncms8.1.3
do_action('tag_synced', $objectId, $objectType, $tagIds);

Params:

  • $objectId (int) : id nội dung
  • $objectType (string) : loại đối tượng (thường là post)
  • $tagIds (array) : danh sách id thẻ sau khi đồng bộ

Trang lưu trữ theo thẻ (frontend)​

HooksLoại HookMô tả
tag_controllers_index_tagfilterĐối tượng thẻ của trang lưu trữ
tag_controllers_index_argsfilterQuery bài viết ($query, $tag)
tag_controllers_index_countfilterTổng số bài viết dùng để phân trang
tag_controllers_index_pagingfilterĐối tượng phân trang
tag_controllers_index_paramsfilterQuery sau khi áp limit / offset / order
tag_controllers_index_objectsfilterDanh sách bài viết trả về