ILIAS  trunk Revision v11.0_alpha-1723-g8e69f309bab
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilMMTypeHandlerRepositoryLink Class Reference

Class ilMMTypeHandlerRepositoryLink. More...

+ Inheritance diagram for ilMMTypeHandlerRepositoryLink:
+ Collaboration diagram for ilMMTypeHandlerRepositoryLink:

Public Member Functions

 matchesForType ()
 
Returns
string Classname of matching Type this TypeHandler can handle
More...
 
 enrichItem (isItem $item)
 
Parameters
isItem$item
Returns
isItem
More...
 
 getAdditionalFieldsForSubForm (IdentificationInterface $identification)
 
Parameters
IdentificationInterface$identification
Returns
FormInput[]
More...
 
- Public Member Functions inherited from ilMMAbstractBaseTypeHandlerAction
 __construct ()
 
 matchesForType ()
 
 enrichItem (isItem $item)
 
Parameters
isItem$item
Returns
isItem
More...
 
 saveFormFields (IdentificationInterface $identification, array $data)
 
Parameters
IdentificationInterface$identification
array$data
Returns
bool
More...
 

Protected Member Functions

 getFieldTranslation ()
 
 getFieldInfoTranslation ()
 
- Protected Member Functions inherited from ilMMAbstractBaseTypeHandlerAction
 getFieldTranslation ()
 
 getFieldInfoTranslation ()
 

Additional Inherited Members

- Data Fields inherited from ilMMAbstractBaseTypeHandlerAction
const F_ACTION = 'action'
 
const F_EXTERNAL = 'external'
 
- Protected Attributes inherited from ilMMAbstractBaseTypeHandlerAction
array $links = []
 

Detailed Description

Member Function Documentation

◆ enrichItem()

ilMMTypeHandlerRepositoryLink::enrichItem ( isItem  $item)

Parameters
isItem$item
Returns
isItem

Implements ILIAS\GlobalScreen\Scope\MainMenu\Collector\Handler\TypeHandler.

Definition at line 45 of file class.ilMMTypeHandlerRepositoryLink.php.

References $DIC, $ref_id, ILIAS\GlobalScreen\isGlobalScreenItem\getProviderIdentification(), ILIAS\Repository\int(), ILIAS\GlobalScreen\Scope\MainMenu\Factory\isItem\isVisible(), and ILIAS\GlobalScreen\Scope\MainMenu\Factory\isItem\withVisibilityCallable().

45  : isItem
46  {
47  global $DIC;
48  if ($item instanceof RepositoryLink && isset($this->links[$item->getProviderIdentification()->serialize()][self::F_ACTION])) {
49  $ref_id = (int) $this->links[$item->getProviderIdentification()->serialize()][self::F_ACTION];
50  $item = $item->withRefId($ref_id)
52  function () use ($DIC, $ref_id, $item): bool {
53  $is_visible_parent = $item->isVisible();
54  $has_access = $DIC->access()->checkAccess('join', '', $ref_id)
55  || $DIC->access()->checkAccess('read', '', $ref_id);
56 
57  return $is_visible_parent
58  && $has_access;
59  }
60  );
61  }
62 
63  return $item;
64  }
withVisibilityCallable(callable $is_visible)
Pass a callable which can decide whether your element is visible for the current user.
$ref_id
Definition: ltiauth.php:65
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:

◆ getAdditionalFieldsForSubForm()

ilMMTypeHandlerRepositoryLink::getAdditionalFieldsForSubForm ( IdentificationInterface  $identification)

Parameters
IdentificationInterface$identification
Returns
FormInput[]

Implements ILIAS\GlobalScreen\Scope\MainMenu\Collector\Handler\TypeHandler.

Definition at line 71 of file class.ilMMTypeHandlerRepositoryLink.php.

References $DIC, $url, getFieldTranslation(), and SYSTEM_FOLDER_ID.

71  : array
72  {
73  global $DIC;
74  $url = $DIC->ui()->factory()->input()->field()->numeric($this->getFieldTranslation())
75  ->withAdditionalTransformation(
76  $DIC->refinery()->custom()->constraint(
77  fn($value): bool => !$DIC->repositoryTree()->isGrandChild(SYSTEM_FOLDER_ID, $value),
78  $DIC->language()->txt("msg_ref_id_not_callable")
79  )
80  );
81  if (isset($this->links[$identification->serialize()][self::F_ACTION]) && is_numeric($this->links[$identification->serialize()][self::F_ACTION])) {
82  $url = $url->withValue((int) $this->links[$identification->serialize()][self::F_ACTION]);
83  }
84 
85  return [self::F_ACTION => $url];
86  }
$url
Definition: shib_logout.php:66
const SYSTEM_FOLDER_ID
Definition: constants.php:35
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:

◆ getFieldInfoTranslation()

ilMMTypeHandlerRepositoryLink::getFieldInfoTranslation ( )
protected

Definition at line 103 of file class.ilMMTypeHandlerRepositoryLink.php.

References $DIC.

103  : string
104  {
105  global $DIC;
106 
107  return $DIC->language()->txt("field_ref_id_info");
108  }
global $DIC
Definition: shib_login.php:22

◆ getFieldTranslation()

ilMMTypeHandlerRepositoryLink::getFieldTranslation ( )
protected

Definition at line 92 of file class.ilMMTypeHandlerRepositoryLink.php.

References $DIC.

Referenced by getAdditionalFieldsForSubForm().

92  : string
93  {
94  global $DIC;
95 
96  return $DIC->language()->txt("field_ref_id");
97  }
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

◆ matchesForType()

ilMMTypeHandlerRepositoryLink::matchesForType ( )

Returns
string Classname of matching Type this TypeHandler can handle

Implements ILIAS\GlobalScreen\Scope\MainMenu\Collector\Handler\TypeHandler.

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

36  : string
37  {
38  return RepositoryLink::class;
39  }

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