ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
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 (protected 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
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

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

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

References ILIAS\GlobalScreen\Provider\__construct().

37  {
38  $this->md = $dic->learningObjectMetadata();
40  }
__construct(Container $dic, ilPlugin $plugin)
$dic
Definition: ltiresult.php:33
+ Here is the call graph for this function:

Member Function Documentation

◆ copyrightReader()

ilMDKeywordExposer::copyrightReader ( int  $object_id)
protected

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

References $path, and ilObject\_lookupType().

Referenced by getContentModification().

104  : Reader
105  {
106  $path = $this->md->paths()->custom()
107  ->withNextStep('rights')
108  ->withNextStep('description')
109  ->withNextStep('string')
110  ->get();
111  return $this->md->read(
112  $object_id,
113  $object_id,
114  ilObject::_lookupType($object_id),
115  $path
116  );
117  }
$path
Definition: ltiservices.php:30
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 93 of file class.ilMDKeywordExposer.php.

References $path, and ilObject\_lookupType().

Referenced by getContentModification().

93  : Reader
94  {
95  $path = $this->md->paths()->custom()->withNextStep('general')->get();
96  return $this->md->read(
97  $object_id,
98  $object_id,
99  ilObject::_lookupType($object_id),
100  $path
101  );
102  }
$path
Definition: ltiservices.php:30
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 copyrightReader(), ILIAS\GlobalScreen\ScreenContext\Stack\CalledContexts\current(), generalReader(), 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  // Copyright
77  if ($this->md->copyrightHelper()->isCopyrightSelectionActive()) {
78  $reader = $this->copyrightReader($object_id);
79  if ($this->md->copyrightHelper()->hasPresetCopyright($reader)) {
80  $copyright = $this->md->copyrightHelper()->readPresetCopyright($reader)->presentAsString();
81  } else {
82  $copyright = $this->md->copyrightHelper()->readCustomCopyright($reader);
83  }
84  $this->globalScreen()->layout()->meta()->addMetaDatum(
85  $this->data->htmlMetadata()->userDefined('copyright', $copyright)
86  );
87  }
88  }
89 
90  return null;
91  }
+ 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: