‪TYPO3CMS  ‪main
ImmediateActionElement.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
19 
21 
28 {
29  protected string ‪$action;
30  protected ?array ‪$args = null;
31 
32  public static function ‪forAction(string ‪$action): self
33  {
34  return new self(‪$action, null);
35  }
36 
37  public static function ‪moduleStateUpdate(string $module, ‪$identifier, bool $select = null): self
38  {
39  return new self(
40  'TYPO3.Backend.Storage.ModuleStateStorage.update',
41  [$module, ‪$identifier, $select]
42  );
43  }
44 
45  public static function ‪moduleStateUpdateWithCurrentMount(string $module, ‪$identifier, bool $select = null): self
46  {
47  return new self(
48  'TYPO3.Backend.Storage.ModuleStateStorage.updateWithCurrentMount',
49  [$module, ‪$identifier, $select]
50  );
51  }
52 
53  public static function ‪dispatchCustomEvent(string $name, array ‪$details = null, bool $useTop = false): self
54  {
55  return new self(
56  'TYPO3.Backend.Event.EventDispatcher.dispatchCustomEvent',
57  [$name, ‪$details, $useTop]
58  );
59  }
60 
61  private function ‪__construct(string ‪$action, ?array ‪$args)
62  {
63  $this->action = ‪$action;
64  $this->args = ‪$args;
65  }
66 
67  public function ‪__toString(): string
68  {
69  $attributes = ['action' => ‪$this->action];
70  if ($this->args !== null) {
71  $attributes['args'] = GeneralUtility::jsonEncodeForHtmlAttribute($this->args);
72  }
73  return sprintf(
74  '<typo3-immediate-action %s></typo3-immediate-action>',
75  GeneralUtility::implodeAttributes($attributes, true)
76  );
77  }
78 }
‪TYPO3\CMS\Backend\Domain\Model\Element\ImmediateActionElement\__construct
‪__construct(string $action, ?array $args)
Definition: ImmediateActionElement.php:61
‪TYPO3\CMS\Webhooks\Message\$details
‪identifier readonly UriInterface readonly array $details
Definition: MfaVerificationErrorOccurredMessage.php:37
‪TYPO3\CMS\Backend\Domain\Model\Element\ImmediateActionElement\moduleStateUpdateWithCurrentMount
‪static moduleStateUpdateWithCurrentMount(string $module, $identifier, bool $select=null)
Definition: ImmediateActionElement.php:45
‪TYPO3\CMS\Backend\Domain\Model\Element\ImmediateActionElement\moduleStateUpdate
‪static moduleStateUpdate(string $module, $identifier, bool $select=null)
Definition: ImmediateActionElement.php:37
‪TYPO3\CMS\Backend\Domain\Model\Element\ImmediateActionElement\dispatchCustomEvent
‪static dispatchCustomEvent(string $name, array $details=null, bool $useTop=false)
Definition: ImmediateActionElement.php:53
‪TYPO3\CMS\Backend\Domain\Model\Element\ImmediateActionElement\$args
‪array $args
Definition: ImmediateActionElement.php:30
‪TYPO3\CMS\Backend\Domain\Model\Element\ImmediateActionElement\__toString
‪__toString()
Definition: ImmediateActionElement.php:67
‪TYPO3\CMS\Backend\Domain\Model\Element\ImmediateActionElement\forAction
‪static forAction(string $action)
Definition: ImmediateActionElement.php:32
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:52
‪TYPO3\CMS\Backend\Domain\Model\Element
Definition: ImmediateActionElement.php:18
‪TYPO3\CMS\Backend\Domain\Model\Element\ImmediateActionElement
Definition: ImmediateActionElement.php:28
‪TYPO3\CMS\Backend\Domain\Model\Element\ImmediateActionElement\$action
‪string $action
Definition: ImmediateActionElement.php:29
‪TYPO3\CMS\Webhooks\Message\$identifier
‪identifier readonly string $identifier
Definition: FileAddedMessage.php:37