PluginProbe
Depicter — Popup & Slider Builder / 1.9.2
Depicter — Popup & Slider Builder v1.9.2
4.8.1 trunk 1.0.0 1.1.0 1.1.2 1.1.4 1.1.6 1.1.7 1.1.8 1.1.9 1.2.0 1.3.0 1.3.1 1.3.2 1.3.3 1.3.5 1.3.8 1.5.0 1.5.1 1.5.2 1.5.5 1.6.0 1.6.1 1.6.2 1.7.0 All 76 releases
depicter / app / src / Document / Models / Elements / Bullet.php

Bullet.php in Depicter — Popup & Slider Builder 1.9.2, at app/src/Document/Models/Elements/Bullet.php

110 lines 3.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace Depicter\Document\Models\Elements;
3
4 use Depicter\Document\Models;
5 use Depicter\Html\Html;
6
7 class Bullet extends Models\Element
8 {
9
10 public function render() {
11
12 $args = $this->getDefaultAttributes();
13 return Html::div( $args );
14 }
15
16 /**
17 * get bullet item selector
18 * @return string
19 */
20 protected function getBulletItemSelector() {
21 return '.' . $this->getSelector() . ' .depicter-bullet-item';
22 }
23
24 /**
25 * get active bullet item selector
26 * @return string
27 */
28 protected function getActiveBulletItemSelector() {
29 return '.' . $this->getSelector() . ' .depicter-bullet-item.depicter-bullet-active';
30 }
31
32 /**
33 * get bullet items css
34 * @return array
35 */
36 protected function getBulletItemCss() {
37 $styles = [];
38
39 foreach ( $this->devices as $device ) {
40
41 if ( isset( $this->options->bullet->styles->color->{$device} ) ) {
42 $styles[ $device ]['background-color'] = $this->options->bullet->styles->color->{$device};
43 }
44
45 if ( isset( $this->options->bullet->hover->color->{$device} ) ) {
46 $styles['hover'][ $device ]['background-color'] = $this->options->bullet->hover->color->{$device};
47 }
48
49 if ( isset( $this->options->bullet->styles->corner->{$device} ) ) {
50 $styles[ $device ]['border-radius'] = $this->getBulletItemBorderRadius( $this->options->bullet->styles->corner->{$device} );
51 }
52
53 if ( isset( $this->options->bullet->styles->space->{$device} ) ) {
54 $styles[ $device ]['margin-right'] = $this->options->bullet->styles->space->{$device}->right->value . $this->options->bullet->styles->space->{$device}->right->unit;
55 }
56
57 if ( isset( $this->options->bullet->styles->size->{$device} ) ) {
58 $styles[ $device ]['width'] = $this->options->bullet->styles->size->{$device}->width->value . $this->options->bullet->styles->size->{$device}->width->unit;
59 $styles[ $device ]['height'] = $this->options->bullet->styles->size->{$device}->height->value . $this->options->bullet->styles->size->{$device}->height->unit;
60 }
61 }
62
63 return $styles;
64 }
65
66 /**
67 * get bullet item border radius
68 * @param $deviceObject
69 *
70 * @return string
71 */
72 protected function getBulletItemBorderRadius( $deviceObject ) {
73 return $deviceObject->topRight->value . $deviceObject->topRight->unit . ' ' . $deviceObject->bottomRight->value . $deviceObject->bottomRight->unit . ' ' . $deviceObject->bottomLeft->value . $deviceObject->bottomLeft->unit . ' ' . $deviceObject->topLeft->value . $deviceObject->topLeft->unit . ' ';
74 }
75
76 /**
77 * get active bullets item css
78 * @return array
79 */
80 protected function getActiveBulletItemCss() {
81 $styles = [];
82 foreach ( $this->devices as $device ) {
83 if ( isset( $this->options->bullet->styles->activeColor->{$device} ) ) {
84 $styles[ $device ]['background-color'] = $this->options->bullet->styles->activeColor->{$device};
85 }
86
87 if ( isset( $this->options->bullet->hover->color->{$device} ) ) {
88 $styles['hover'][ $device ]['background-color'] = $this->options->bullet->hover->color->{$device};
89 }
90 }
91
92 return $styles;
93 }
94
95 /**
96 * Get list of selector and CSS for element
97 *
98 * @return array
99 * @throws \JsonMapper_Exception
100 */
101 public function getSelectorAndCssList(){
102 parent::getSelectorAndCssList();
103
104 $this->selectorCssList[ $this->getBulletItemSelector() ] = $this->getBulletItemCss();
105 $this->selectorCssList[ $this->getActiveBulletItemSelector() ] = $this->getActiveBulletItemCss();
106
107 return $this->selectorCssList;
108 }
109 }
110