ILIAS  trunk Revision v11.0_alpha-1731-gff9cd7e2bd3
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
class.ilWebLinkDraftParameter.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
26 {
30  public const string LINKS_ERR_NO_NAME = 'links_no_name_given';
31  public const string LINKS_ERR_NO_VALUE = 'links_no_value_given';
32  public const string LINKS_ERR_NO_NAME_VALUE = 'links_no_name_no_value';
33 
34 
36 
37  public function replaces(?ilWebLinkParameter $old_parameter): ilWebLinkDraftParameter
38  {
39  $this->old_parameter = $old_parameter;
40  return $this;
41  }
42 
43  public function getOldParameter(): ?ilWebLinkParameter
44  {
45  return $this->old_parameter;
46  }
47 
52  public function validate(): string
53  {
54  if (!strlen($this->getName()) && !$this->getValue()) {
55  return self::LINKS_ERR_NO_NAME_VALUE;
56  }
57  if (!strlen($this->getName())) {
58  return self::LINKS_ERR_NO_NAME;
59  }
60  if (!$this->getValue()) {
61  return self::LINKS_ERR_NO_VALUE;
62  }
63  return '';
64  }
65 }
Draft class for creating and updating a parameter attached to Web Link items.
Immutable class for parameters attached to Web Link items.
replaces(?ilWebLinkParameter $old_parameter)
validate()
TODO: Modernizing the forms to input parameters will make this additional layer of input validation o...
Base class for parameters attached to Web Link items.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
const string LINKS_ERR_NO_NAME
TODO: This can be removed when validate is.