ILIAS  trunk Revision v11.0_alpha-2658-ge2404539063
ILIAS\UICore\PageContentProvider Class Reference
+ Inheritance diagram for ILIAS\UICore\PageContentProvider:
+ Collaboration diagram for ILIAS\UICore\PageContentProvider:

Public Member Functions

 isInterestedInContexts ()
 
 getContentModification (CalledContexts $screen_context_stack)
 
- Public Member Functions inherited from ILIAS\GlobalScreen\Scope\Layout\Provider\AbstractModificationProvider
 __construct (Container $dic)
 
 getContentModification (CalledContexts $screen_context_stack)
 
 getLogoModification (CalledContexts $screen_context_stack)
 
 getResponsiveLogoModification (CalledContexts $screen_context_stack)
 
 getMainBarModification (CalledContexts $screen_context_stack)
 
 getMetaBarModification (CalledContexts $screen_context_stack)
 
 getBreadCrumbsModification (CalledContexts $screen_context_stack)
 
 getFooterModification (CalledContexts $screen_context_stack)
 
 getPageBuilderDecorator (CalledContexts $screen_context_stack)
 
 getTitleModification (CalledContexts $screen_context_stack)
 
 getShortTitleModification (CalledContexts $screen_context_stack)
 
 getViewTitleModification (CalledContexts $screen_context_stack)
 
- Public Member Functions inherited from ILIAS\GlobalScreen\Provider\AbstractProvider
 __construct (protected Container $dic)
 
 getFullyQualifiedClassName ()
 
 getProviderNameForPresentation ()
 

Static Public Member Functions

static setContent (string $content)
 
static setTitle (string $title)
 
static setShortTitle (string $short_title)
 
static setViewTitle (string $view_title)
 
static setPermaLink (string $perma_link)
 
static getPermaLink ()
 

Private Member Functions

 buildTabTitle ()
 This method was introduced due to A11y problems, see https://mantis.ilias.de/view.php?id=31534. More...
 

Static Private Attributes

static string $content = ""
 
static string $perma_link = ""
 
static string $title = ""
 
static string $short_title = ""
 
static string $view_title = ""
 

Additional Inherited Members

- Protected Member Functions inherited from ILIAS\GlobalScreen\Provider\AbstractProvider
 globalScreen ()
 
- Protected Attributes inherited from ILIAS\GlobalScreen\Scope\Layout\Provider\AbstractModificationProvider
ContextCollection $context_collection
 
DataFactory $data
 
ModificationFactory $factory
 

Detailed Description

Member Function Documentation

◆ buildTabTitle()

ILIAS\UICore\PageContentProvider::buildTabTitle ( )
private

This method was introduced due to A11y problems, see https://mantis.ilias.de/view.php?id=31534.

This is definitely only a workaround, but since this is currently the only way to implement it, it is just introduced... We keep all the logic within this method because we don't want this to become common or even used elsewhere. Hence certain things as anonymous functions...

Definition at line 126 of file PageContentProvider.php.

Referenced by ILIAS\UICore\PageContentProvider\getContentModification().

126  : string
127  {
128  // This anonymous function generates a translated title from a "tab" array.
129  // in some cases the tabs are already translated (dir_text = true), in others not...
130  $tab_title_generator = function (array $tab): string {
131  $tab_title = ($tab['dir_text'] ?? false) === false ? $this->dic->language()->txt($tab['text']) : $tab['text'] ?? '';
132  return $tab_title . ': ';
133  };
134 
135  // we only know the 'id' of the active tab and don't want to rely on the array index, so we
136  // loop over tabs or subtabs to find the "right" one
137  $tab_looper = static function (array $tabs, string $active_tab) use ($tab_title_generator): string {
138  $tab_title = '';
139  foreach ($tabs as $tab) {
140  if ($tab['id'] === $active_tab) {
141  $tab_title = $tab_title_generator($tab);
142  break;
143  }
144  }
145  return $tab_title;
146  };
147 
148  // TABS
149  $tabs = $this->dic->tabs()->target; // this only works because target is currently public...
150  $active_tab = $this->dic->tabs()->getActiveTab();
151  if ($active_tab === '' && isset($tabs[0])) {
152  $active_tab = $tabs[0]['id']; // if no tab is active, use the first one
153  }
154 
155  $tab_title = $tab_looper($tabs, $active_tab);
156 
157  // SUBTABS
158  $subtab_title = '';
159  $subtabs = $this->dic->tabs()->sub_target; // this only works because subtarget is currently public...
160  if (count($subtabs) > 1) { // we only need to do something if there are more than one subtabs
161  $active_subtab = array_values(
162  array_filter($subtabs, static fn(array $subtab): bool => $subtab['activate'] ?? false)
163  )[0]['id'] ?? '';
164 
165  if ($active_subtab === '' && isset($subtabs[0])) {
166  $active_subtab = $subtabs[0]['id']; // if no tab is active, use the first one
167  }
168  $subtab_title = $tab_looper($subtabs, $active_subtab);
169  }
170 
171  return $subtab_title . $tab_title;
172  }
+ Here is the caller graph for this function:

◆ getContentModification()

ILIAS\UICore\PageContentProvider::getContentModification ( CalledContexts  $screen_context_stack)
Parameters
CalledContexts$screen_context_stack
Returns
ContentModification

Implements ILIAS\GlobalScreen\Scope\Layout\Provider\ModificationProvider.

Definition at line 78 of file PageContentProvider.php.

References ILIAS\UICore\PageContentProvider\buildTabTitle(), ILIAS\GlobalScreen\Scope\Layout\Provider\AbstractModificationProvider\getShortTitleModification(), ILIAS\GlobalScreen\Scope\Layout\Provider\AbstractModificationProvider\getTitleModification(), ILIAS\GlobalScreen\Scope\Layout\Provider\AbstractModificationProvider\getViewTitleModification(), and ILIAS\GlobalScreen\Provider\AbstractProvider\globalScreen().

78  : ?ContentModification
79  {
80  return $this->globalScreen()->layout()->factory()->content()->withModification(function (
81  ?Content $content
82  ): ?Content {
83  $ui = $this->dic->ui();
84  return $ui->factory()->legacy()->content(
85  $ui->renderer()->render($content) . self::$content
86  );
87  })->withLowPriority();
88  }
+ Here is the call graph for this function:

◆ getPermaLink()

static ILIAS\UICore\PageContentProvider::getPermaLink ( )
static
Deprecated:
this is needed as long as the PageContentProvider is the only place which stores the permalink

Definition at line 177 of file PageContentProvider.php.

177  : string
178  {
179  return self::$perma_link;
180  }

◆ isInterestedInContexts()

ILIAS\UICore\PageContentProvider::isInterestedInContexts ( )
Returns
ContextCollection

Implements ILIAS\GlobalScreen\ScreenContext\ScreenContextAwareProvider.

Definition at line 73 of file PageContentProvider.php.

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

73  : ContextCollection
74  {
75  return $this->context_collection->main();
76  }
+ Here is the call graph for this function:

◆ setContent()

static ILIAS\UICore\PageContentProvider::setContent ( string  $content)
static

Definition at line 48 of file PageContentProvider.php.

References ILIAS\UICore\PageContentProvider\$content.

48  : void
49  {
50  self::$content = $content;
51  }

◆ setPermaLink()

static ILIAS\UICore\PageContentProvider::setPermaLink ( string  $perma_link)
static

Definition at line 68 of file PageContentProvider.php.

References ILIAS\UICore\PageContentProvider\$perma_link.

Referenced by ILIAS\Exercise\PermanentLink\PermanentLinkManager\_setPermanentLink().

68  : void
69  {
70  self::$perma_link = $perma_link;
71  }
+ Here is the caller graph for this function:

◆ setShortTitle()

static ILIAS\UICore\PageContentProvider::setShortTitle ( string  $short_title)
static

Definition at line 58 of file PageContentProvider.php.

References ILIAS\UICore\PageContentProvider\$short_title.

58  : void
59  {
60  self::$short_title = $short_title;
61  }

◆ setTitle()

static ILIAS\UICore\PageContentProvider::setTitle ( string  $title)
static

Definition at line 53 of file PageContentProvider.php.

References ILIAS\UICore\PageContentProvider\$title.

53  : void
54  {
55  self::$title = $title;
56  }

◆ setViewTitle()

static ILIAS\UICore\PageContentProvider::setViewTitle ( string  $view_title)
static

Definition at line 63 of file PageContentProvider.php.

References ILIAS\UICore\PageContentProvider\$view_title.

63  : void
64  {
65  self::$view_title = $view_title;
66  }

Field Documentation

◆ $content

string ILIAS\UICore\PageContentProvider::$content = ""
staticprivate

Definition at line 42 of file PageContentProvider.php.

Referenced by ILIAS\UICore\PageContentProvider\setContent().

◆ $perma_link

string ILIAS\UICore\PageContentProvider::$perma_link = ""
staticprivate

◆ $short_title

string ILIAS\UICore\PageContentProvider::$short_title = ""
staticprivate

◆ $title

string ILIAS\UICore\PageContentProvider::$title = ""
staticprivate

Definition at line 44 of file PageContentProvider.php.

Referenced by ILIAS\UICore\PageContentProvider\setTitle().

◆ $view_title

string ILIAS\UICore\PageContentProvider::$view_title = ""
staticprivate

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