ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilImageLinkButton.php
Go to the documentation of this file.
1<?php
2
26{
27 protected string $src = "";
28 protected bool $force_title = false;
29
30 public static function getInstance(): self
31 {
32 return new self(self::TYPE_LINK);
33 }
34
35
36 //
37 // properties
38 //
39
40 public function setImage(string $a_value, bool $a_is_internal = true): void
41 {
42 if ($a_is_internal) {
43 $a_value = ilUtil::getImagePath($a_value);
44 }
45 $this->src = trim($a_value);
46 }
47
48 public function getImage(): string
49 {
50 return $this->src;
51 }
52
53 public function forceTitle(bool $a_value): void
54 {
55 $this->force_title = $a_value;
56 }
57
58 public function hasForceTitle(): bool
59 {
60 return $this->force_title;
61 }
62
63
64 //
65 // render
66 //
67
68 protected function prepareRender(): void
69 {
70 // get rid of parent "submit" css class...
71 }
72
73 protected function renderCaption(): string
74 {
75 $attr = array();
76 $attr["src"] = $this->getImage();
77 $attr["alt"] = $this->getCaption();
78 if ($this->hasForceTitle()) {
79 $attr["title"] = $this->getCaption();
80 }
81 return '<img' . $this->renderAttributesHelper($attr) . ' />';
82 }
83}
renderAttributesHelper(array $a_attr)
getCaption(bool $a_translate=true)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setImage(string $a_value, bool $a_is_internal=true)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)