ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilCOPageEditGSToolProvider Class Reference

Page editing GS tool provider. More...

+ Inheritance diagram for ilCOPageEditGSToolProvider:
+ Collaboration diagram for ilCOPageEditGSToolProvider:

Public Member Functions

 isInterestedInContexts ()
 
 getToolsForContextStack (CalledContexts $called_contexts)
 
- Public Member Functions inherited from ILIAS\GlobalScreen\Scope\Tool\Provider\AbstractDynamicToolProvider
 __construct (Container $dic)
 @inheritDoc More...
 
- Public Member Functions inherited from ILIAS\GlobalScreen\Provider\AbstractProvider
 __construct (protected Container $dic)
 
 getFullyQualifiedClassName ()
 
 getProviderNameForPresentation ()
 
 getFullyQualifiedClassName ()
 
 getProviderNameForPresentation ()
 
 getToolsForContextStack (CalledContexts $called_contexts)
 
 isInterestedInContexts ()
 

Data Fields

const SHOW_EDITOR = 'copg_show_editor'
 

Private Member Functions

 getContent ()
 

Additional Inherited Members

- Protected Member Functions inherited from ILIAS\GlobalScreen\Provider\AbstractProvider
 globalScreen ()
 
- Protected Attributes inherited from ILIAS\GlobalScreen\Scope\Tool\Provider\AbstractDynamicToolProvider
ToolIdentificationProviderInterface $identification_provider
 
ContextCollection $context_collection
 
ToolFactory $factory
 

Detailed Description

Page editing GS tool provider.

Author
Alex Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..com

Definition at line 30 of file class.ilCOPageEditGSToolProvider.php.

Member Function Documentation

◆ getContent()

ilCOPageEditGSToolProvider::getContent ( )
private

Definition at line 79 of file class.ilCOPageEditGSToolProvider.php.

79 : string
80 {
81 return "<div id='copg-editor-slate-error'></div><div id='copg-editor-slate-content'></div>";
82 }

Referenced by getToolsForContextStack().

+ Here is the caller graph for this function:

◆ getToolsForContextStack()

ilCOPageEditGSToolProvider::getToolsForContextStack ( CalledContexts  $called_contexts)
Parameters
CalledContexts$called_contexts
Returns
Tool[] These Slates can be passed to the MainMenu dynamic for a specific location/context.
See also
DynamicProvider

Implements ILIAS\GlobalScreen\Scope\Tool\Provider\DynamicToolProvider.

Definition at line 40 of file class.ilCOPageEditGSToolProvider.php.

40 : array
41 {
42 $tools = [];
43 $additional_data = $called_contexts->current()->getAdditionalData();
44 if ($additional_data->is(self::SHOW_EDITOR, true)) {
45 $title = $this->dic->language()->txt('editor');
46 $icon = $this->dic->ui()->factory()->symbol()->icon()->custom(\ilUtil::getImagePath("standard/icon_edtr.svg"), $title);
47
48 $iff = function ($id) {
49 return $this->identification_provider->contextAwareIdentifier($id);
50 };
51 $l = function (string $content) {
52 return $this->dic->ui()->factory()->legacy()->content($content);
53 };
54 $identification = $iff("copg_editor");
55 $hashed = $this->hash($identification->serialize());
56 $tools[] = $this->factory->tool($identification)
57 ->addComponentDecorator(static function (ILIAS\UI\Component\Component $c) use ($hashed): ILIAS\UI\Component\Component {
58 if ($c instanceof LegacySlate) {
59 $signal_id = $c->getToggleSignal()->getId();
60 return $c->withAdditionalOnLoadCode(static function ($id) use ($hashed) {
61 return "
62 $('body').on('il-copg-editor-slate', function(){
63 if (!il.UI.page.isSmallScreen()) {
64 il.UI.maincontrols.mainbar.engageTool('$hashed');
65 }
66 });";
67 });
68 }
69 return $c;
70 })
71 ->withSymbol($icon)
72 ->withTitle($title)
73 ->withContent($l($this->getContent()));
74 }
75
76 return $tools;
77 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
factory()
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
$c
Definition: deliver.php:25
withSymbol(Symbol $symbol)
@inheritDoc
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.

References $c, $id, ILIAS\GlobalScreen\ScreenContext\Stack\CalledContexts\current(), factory(), getContent(), ILIAS\Survey\Mode\getId(), ilUtil\getImagePath(), and ILIAS\GlobalScreen\Scope\MainMenu\Factory\withSymbol().

+ Here is the call graph for this function:

◆ isInterestedInContexts()

ilCOPageEditGSToolProvider::isInterestedInContexts ( )

Field Documentation

◆ SHOW_EDITOR

const ilCOPageEditGSToolProvider::SHOW_EDITOR = 'copg_show_editor'

The documentation for this class was generated from the following file: