ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilWebLinkDraftParameter.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
26 {
30  public const LINKS_ERR_NO_NAME = 'links_no_name_given';
31  public const LINKS_ERR_NO_VALUE = 'links_no_value_given';
32  public const 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 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
replaces(?ilWebLinkParameter $old_parameter)
validate()
TODO: Modernizing the forms to input parameters will make this additional layer of input validation o...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const LINKS_ERR_NO_NAME
TODO: This can be removed when validate is.