ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
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)
 
- Public Member Functions inherited from ILIAS\GlobalScreen\Provider\AbstractProvider
 __construct (Container $dic)
 
 getFullyQualifiedClassName ()
 
 getProviderNameForPresentation ()
 

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
 
- Protected Attributes inherited from ILIAS\GlobalScreen\Provider\AbstractProvider
Container $dic
 

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.

Referenced by getToolsForContextStack().

79  : string
80  {
81  return "<div id='copg-editor-slate-error'></div><div id='copg-editor-slate-content'></div>";
82  }
+ 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.

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

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("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);
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  }
Class Factory.
$c
Definition: cli.php:38
Class ChatMainBarProvider .
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:

◆ isInterestedInContexts()

ilCOPageEditGSToolProvider::isInterestedInContexts ( )
Returns
ContextCollection

Implements ILIAS\GlobalScreen\ScreenContext\ScreenContextAwareProvider.

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

References ILIAS\GlobalScreen\ScreenContext\Stack\ContextCollection\main().

+ Here is the call graph for this function:

Field Documentation

◆ SHOW_EDITOR

const ilCOPageEditGSToolProvider::SHOW_EDITOR = 'copg_show_editor'

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