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

Class ilMDKeywordExposer. More...

+ Inheritance diagram for ilMDKeywordExposer:
+ Collaboration diagram for ilMDKeywordExposer:

Public Member Functions

 __construct (\ILIAS\DI\Container $dic)
 
 isInterestedInContexts ()
 
 getContentModification (CalledContexts $screen_context_stack)
 @inheritDoc More...
 
- Public Member Functions inherited from ILIAS\GlobalScreen\Scope\Layout\Provider\AbstractModificationProvider
 __construct (Container $dic)
 @inheritDoc More...
 
 getContentModification (CalledContexts $screen_context_stack)
 @inheritDoc More...
 
 getLogoModification (CalledContexts $screen_context_stack)
 @inheritDoc More...
 
 getResponsiveLogoModification (CalledContexts $screen_context_stack)
 
 getMainBarModification (CalledContexts $screen_context_stack)
 @inheritDoc More...
 
 getMetaBarModification (CalledContexts $screen_context_stack)
 @inheritDoc More...
 
 getBreadCrumbsModification (CalledContexts $screen_context_stack)
 @inheritDoc More...
 
 getFooterModification (CalledContexts $screen_context_stack)
 @inheritDoc More...
 
 getPageBuilderDecorator (CalledContexts $screen_context_stack)
 @inheritDoc More...
 
 getTitleModification (CalledContexts $screen_context_stack)
 @inheritDoc More...
 
 getShortTitleModification (CalledContexts $screen_context_stack)
 @inheritDoc More...
 
 getViewTitleModification (CalledContexts $screen_context_stack)
 @inheritDoc More...
 
- Public Member Functions inherited from ILIAS\GlobalScreen\Provider\AbstractProvider
 __construct (protected Container $dic)
 
 getFullyQualifiedClassName ()
 
 getProviderNameForPresentation ()
 
 getFullyQualifiedClassName ()
 
 getProviderNameForPresentation ()
 
 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)
 
 isInterestedInContexts ()
 

Protected Member Functions

 generalReader (int $object_id)
 
 copyrightReader (int $object_id)
 
- Protected Member Functions inherited from ILIAS\GlobalScreen\Provider\AbstractProvider
 globalScreen ()
 

Protected Attributes

Metadata $md
 
- Protected Attributes inherited from ILIAS\GlobalScreen\Scope\Layout\Provider\AbstractModificationProvider
ContextCollection $context_collection
 
DataFactory $data
 
ModificationFactory $factory
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilMDKeywordExposer::__construct ( \ILIAS\DI\Container  $dic)

Definition at line 37 of file class.ilMDKeywordExposer.php.

38 {
39 $this->md = $dic->learningObjectMetadata();
41 }
$dic
Definition: ltiresult.php:33
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

References $dic, and ILIAS\GlobalScreen\Provider\__construct().

+ Here is the call graph for this function:

Member Function Documentation

◆ copyrightReader()

ilMDKeywordExposer::copyrightReader ( int  $object_id)
protected

Definition at line 105 of file class.ilMDKeywordExposer.php.

105 : Reader
106 {
107 $path = $this->md->paths()->custom()
108 ->withNextStep('rights')
109 ->withNextStep('description')
110 ->withNextStep('string')
111 ->get();
112 return $this->md->read(
113 $object_id,
114 $object_id,
115 ilObject::_lookupType($object_id),
116 $path
117 );
118 }
static _lookupType(int $id, bool $reference=false)
$path
Definition: ltiservices.php:30

References $path, and ilObject\_lookupType().

Referenced by getContentModification().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ generalReader()

ilMDKeywordExposer::generalReader ( int  $object_id)
protected

Definition at line 94 of file class.ilMDKeywordExposer.php.

94 : Reader
95 {
96 $path = $this->md->paths()->custom()->withNextStep('general')->get();
97 return $this->md->read(
98 $object_id,
99 $object_id,
100 ilObject::_lookupType($object_id),
101 $path
102 );
103 }

References $path, and ilObject\_lookupType().

Referenced by getContentModification().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getContentModification()

ilMDKeywordExposer::getContentModification ( CalledContexts  $screen_context_stack)

@inheritDoc

Reimplemented from ILIAS\GlobalScreen\Scope\Layout\Provider\AbstractModificationProvider.

Definition at line 48 of file class.ilMDKeywordExposer.php.

49 {
50 if ($screen_context_stack->current()->hasReferenceId()) {
51 $object_id = $screen_context_stack->current()->getReferenceId()->toObjectId()->toInt();
52 $paths = $this->md->paths();
53 $reader = $this->generalReader($object_id);
54
55 // Keywords
56 $keywords = [];
57 foreach ($reader->allData($paths->keywords()) as $keyword) {
58 $keywords[] = $keyword->value();
59 }
60 if (count($keywords) > 0) {
61 $this->globalScreen()->layout()->meta()->addMetaDatum(
62 $this->data->htmlMetadata()->userDefined('keywords', implode(',', $keywords))
63 );
64 }
65
66 // Languages
67 $languages = [];
68 foreach ($reader->allData($paths->languages()) as $language) {
69 $languages[] = $language->value();
70 }
71 if (count($languages) > 0) {
72 $this->globalScreen()->layout()->meta()->addMetaDatum(
73 $this->data->htmlMetadata()->userDefined('languages', implode(',', $languages))
74 );
75 }
76
77 // Copyright
78 if ($this->md->copyrightHelper()->isCopyrightSelectionActive()) {
79 $reader = $this->copyrightReader($object_id);
80 if ($this->md->copyrightHelper()->hasPresetCopyright($reader)) {
81 $copyright = $this->md->copyrightHelper()->readPresetCopyright($reader)->presentAsString();
82 } else {
83 $copyright = $this->md->copyrightHelper()->readCustomCopyright($reader);
84 }
85 $this->globalScreen()->layout()->meta()->addMetaDatum(
86 $this->data->htmlMetadata()->userDefined('copyright', $copyright)
87 );
88 }
89 }
90
91 return null;
92 }

References copyrightReader(), ILIAS\GlobalScreen\ScreenContext\Stack\CalledContexts\current(), generalReader(), and ILIAS\GlobalScreen\Provider\AbstractProvider\globalScreen().

+ Here is the call graph for this function:

◆ isInterestedInContexts()

ilMDKeywordExposer::isInterestedInContexts ( )

Field Documentation

◆ $md

Metadata ilMDKeywordExposer::$md
protected

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


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