ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
Card.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 2016 Amstutz Timon <timon.amstutz@ilub.unibe.ch> Extended GPL, see docs/LICENSE */
4
6
9
10class Card implements C\Card
11{
13
17 protected $title;
18
22 protected $header_section;
23
28
32 protected $image;
33
37 protected $title_url = '';
38
42 protected $highlight = false;
43
48 public function __construct($title, \ILIAS\UI\Component\Image\Image $image = null)
49 {
50 $this->checkStringArg("title", $title);
51
52 $this->title = $title;
53 $this->image = $image;
54 }
55
59 public function withTitle($title)
60 {
61 $this->checkStringArg("title", $title);
62
63 $clone = clone $this;
64 $clone->title = $title;
65
66 return $clone;
67 }
68
72 public function getTitle()
73 {
74 return $this->title;
75 }
76
80 public function withImage(\ILIAS\UI\Component\Image\Image $image)
81 {
82 $clone = clone $this;
83 $clone->image = $image;
84 return $clone;
85 }
86
90 public function getImage()
91 {
92 return $this->image;
93 }
94
98 public function withSections(array $sections)
99 {
100 $classes = [\ILIAS\UI\Component\Component::class];
101 $this->checkArgListElements("sections", $sections, $classes);
102
103 $clone = clone $this;
104 $clone->content_sections = $sections;
105 return $clone;
106 }
107
111 public function getSections()
112 {
114 }
115
119 public function withTitleAction($url)
120 {
121 $this->checkStringArg("title_url", $url);
122
123 $clone = clone $this;
124 $clone->title_url = $url;
125
126 return $clone;
127 }
128
132 public function getTitleAction()
133 {
134 return $this->title_url;
135 }
136
140 public function withHighlight($status)
141 {
142 $clone = clone $this;
143 $clone->highlight = $status;
144
145 return $clone;
146 }
147
151 public function isHighlighted()
152 {
153 return $this->highlight;
154 }
155}
An exception for terminatinating execution or to throw for unit testing.
withImage(\ILIAS\UI\Component\Image\Image $image)
Definition: Card.php:80
__construct($title, \ILIAS\UI\Component\Image\Image $image=null)
Definition: Card.php:48
A component is the most general form of an entity in the UI.
Definition: Component.php:14
checkStringArg($which, $value)
Throw an InvalidArgumentException if $value is no string.
checkArgListElements($which, array &$values, &$classes)
Check every element of the list if it is an instance of one of the given classes.
trait ComponentHelper
Provides common functionality for component implementations.
Class BaseForm.
Class Factory.
$url