Elgg  Version master
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\Event $event) {
20 
21  if ($event->getType() !== $this->getContentType()) {
22  // not the correct event registration
23  return;
24  }
25 
26  $container = $event->getParam('container');
27  if (!$container instanceof \ElggGroup) {
28  return;
29  }
30 
31  if ($event->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.
__invoke(\Elgg\Event $event)
Listen to the container logic check event.
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.
$container
Definition: delete.php:24
Models an event passed to event handlers.
Definition: Event.php:11