ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
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)
 
- 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 (Container $dic)
 
 getFullyQualifiedClassName ()
 
 getProviderNameForPresentation ()
 

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

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

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

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

References ILIAS\MetaData\Repository\Validation\Data\__construct().

37  {
38  $this->md = $dic->learningObjectMetadata();
40  }
__construct(VocabulariesInterface $vocabularies)
+ Here is the call graph for this function:

Member Function Documentation

◆ copyrightReader()

ilMDKeywordExposer::copyrightReader ( int  $object_id)
protected

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

References $path, and ilObject\_lookupType().

Referenced by getContentModification().

109  : Reader
110  {
111  $path = $this->md->paths()->custom()
112  ->withNextStep('rights')
113  ->withNextStep('description')
114  ->withNextStep('string')
115  ->get();
116  return $this->md->read(
117  $object_id,
118  $object_id,
119  ilObject::_lookupType($object_id),
120  $path
121  );
122  }
$path
Definition: ltiservices.php:32
static _lookupType(int $id, bool $reference=false)
+ 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 98 of file class.ilMDKeywordExposer.php.

References $path, and ilObject\_lookupType().

Referenced by getContentModification().

98  : Reader
99  {
100  $path = $this->md->paths()->custom()->withNextStep('general')->get();
101  return $this->md->read(
102  $object_id,
103  $object_id,
104  ilObject::_lookupType($object_id),
105  $path
106  );
107  }
$path
Definition: ltiservices.php:32
static _lookupType(int $id, bool $reference=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getContentModification()

ilMDKeywordExposer::getContentModification ( CalledContexts  $screen_context_stack)
Parameters
CalledContexts$screen_context_stack
Returns
ContentModification

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

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

References ILIAS\LTI\ToolProvider\$settings, ilMDCopyrightSelectionEntry\_extractEntryId(), ilMDSettings\_getInstance(), copyrightReader(), ILIAS\GlobalScreen\ScreenContext\Stack\CalledContexts\current(), generalReader(), ilMDCopyrightSelectionEntry\getDefault(), and ILIAS\GlobalScreen\Provider\AbstractProvider\globalScreen().

48  {
49  if ($screen_context_stack->current()->hasReferenceId()) {
50  $object_id = $screen_context_stack->current()->getReferenceId()->toObjectId()->toInt();
51  $paths = $this->md->paths();
52  $reader = $this->generalReader($object_id);
53 
54  // Keywords
55  $keywords = [];
56  foreach ($reader->allData($paths->keywords()) as $keyword) {
57  $keywords[] = $keyword->value();
58  }
59  if (count($keywords) > 0) {
60  $this->globalScreen()->layout()->meta()->addMetaDatum(
61  $this->data->htmlMetadata()->userDefined('keywords', implode(',', $keywords))
62  );
63  }
64 
65  // Languages
66  $languages = [];
67  foreach ($reader->allData($paths->languages()) as $language) {
68  $languages[] = $language->value();
69  }
70  if (count($languages) > 0) {
71  $this->globalScreen()->layout()->meta()->addMetaDatum(
72  $this->data->htmlMetadata()->userDefined('languages', implode(',', $languages))
73  );
74  }
75 
76  if ($settings = ilMDSettings::_getInstance()->isCopyrightSelectionActive()) {
77  $reader = $this->copyrightReader($object_id);
78  // Copyright
79  $copyright = $reader->firstData($paths->copyright())->value();
80  $copyright_id = ilMDCopyrightSelectionEntry::_extractEntryId($copyright);
81  if ($copyright_id > 0) {
82  $entry = new ilMDCopyrightSelectionEntry($copyright_id);
83  $copyright = $entry->getTitle();
84  }
85  if ($copyright === '') {
87  $copyright = $entry->getTitle();
88  }
89  $this->globalScreen()->layout()->meta()->addMetaDatum(
90  $this->data->htmlMetadata()->userDefined('copyright', $copyright)
91  );
92  }
93  }
94 
95  return null;
96  }
array $settings
Setting values (LTI parameters, custom parameters and local parameters).
Definition: System.php:200
+ Here is the call graph for this function:

◆ isInterestedInContexts()

ilMDKeywordExposer::isInterestedInContexts ( )

Field Documentation

◆ $md

Metadata ilMDKeywordExposer::$md
protected

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


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