Elgg  Version 4.3
ToolContainerLogicCheck.php
Go to the documentation of this file.
1 <?php
2 
3 namespace Elgg\Groups;
4 
10 abstract class ToolContainerLogicCheck {
11 
19  public function __invoke(\Elgg\Hook $hook) {
20 
21  if ($hook->getType() !== $this->getContentType()) {
22  // not the correct hook registration
23  return;
24  }
25 
26  $container = $hook->getParam('container');
27  if (!$container instanceof \ElggGroup) {
28  return;
29  }
30 
31  if ($hook->getParam('subtype') !== $this->getContentSubtype()) {
32  return;
33  }
34 
35  if ($container->isToolEnabled($this->getToolName())) {
36  return;
37  }
38 
39  return false;
40  }
41 
47  abstract public function getContentType(): string;
48 
54  abstract public function getContentSubtype(): string;
55 
61  abstract public function getToolName(): string;
62 }
getContentSubtype()
Returns the subtype affected by the group tool option.
Check if content can be created in a group based on the group tool option.
Models an event passed to hook handlers.
Definition: Hook.php:11
getToolName()
Returns the name of the group tool option to check if is enabled.
getContentType()
Returns the type of the content affected by the group tool option.
__invoke(\Elgg\Hook $hook)
Listen to the container logic check hook.
$container
Definition: delete.php:23