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ẻ
| Hooks | Loại Hook | Platform | Version |
|---|---|---|---|
manage_tag_columns | filter | cms | 8.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
| Hooks | Loại Hook | Platform | Version |
|---|---|---|---|
admin_tag_table_columns_action | filter | cms | 8.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
| Hooks | Loại Hook | Platform | Version |
|---|---|---|---|
admin_tag_index_view | filter | cms | 8.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ẻ
| Hooks | Loại Hook | Platform | Version |
|---|---|---|---|
manage_tag_input | filter | cms | 8.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
| Hooks | Loại Hook | Platform | Version |
|---|---|---|---|
admin_tag_controllers_edit_args | filter | cms | 8.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
| Hooks | Loại Hook | Platform | Version |
|---|---|---|---|
admin_tag_controllers_edit_objects | filter | cms | 8.1.3 |
$object = apply_filters('admin_tag_controllers_edit_objects', $query->first(), $id);
View trang thêm / sửa
| Hooks | Loại Hook | Platform | Version |
|---|---|---|---|
admin_tag_add_view | filter | cms | 8.1.3 |
admin_tag_edit_view | filter | cms | 8.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
| Hooks | Loại Hook | Platform | Version |
|---|---|---|---|
columns_db_tag | filter | cms | 8.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
| Hooks | Loại Hook | Platform | Version |
|---|---|---|---|
tag_enabled_{tagType} | filter | cms | 8.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
| Hooks | Loại Hook | Platform | Version |
|---|---|---|---|
gets_tags_by_object | filter | cms | 8.1.3 |
return apply_filters('gets_tags_by_object', $query->get(), clone $query);
Sau khi đồng bộ thẻ
| Hooks | Loại Hook | Platform | Version |
|---|---|---|---|
tag_synced | action | cms | 8.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)
| Hooks | Loại Hook | Mô tả |
|---|---|---|
tag_controllers_index_tag | filter | Đối tượng thẻ của trang lưu trữ |
tag_controllers_index_args | filter | Query bài viết ($query, $tag) |
tag_controllers_index_count | filter | Tổng số bài viết dùng để phân trang |
tag_controllers_index_paging | filter | Đối tượng phân trang |
tag_controllers_index_params | filter | Query sau khi áp limit / offset / order |
tag_controllers_index_objects | filter | Danh sách bài viết trả về |