Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

See Tag Only On Active Itemtypes #221

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion inc/tag.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,17 @@ public static function getBlacklistItemtype()
*/
public static function canItemtype($itemtype = '')
{
return !empty($itemtype) && class_exists($itemtype) && !in_array($itemtype, self::getBlacklistItemtype());
$tags = new self();
$types_menu = [];
$use_global_tag = false;
foreach ($tags->find(['is_active' => 1]) as $tag) {
if ($tag['type_menu'] != null) {
$types_menu = array_merge($types_menu, json_decode($tag['type_menu']));
} else {
$use_global_tag = true;
}
}
return !empty($itemtype) && class_exists($itemtype) && !in_array($itemtype, self::getBlacklistItemtype()) && ($use_global_tag == true ? $use_global_tag : in_array($itemtype, $types_menu));
tsmr marked this conversation as resolved.
Show resolved Hide resolved
}

public function showForm($ID, $options = [])
Expand Down
Loading