|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace GinoPane\AwesomeSocialLinks\Models; |
|
4
|
|
|
|
|
5
|
|
|
use GinoPane\AwesomeSocialLinks\Plugin; |
|
6
|
|
|
use Model; |
|
|
|
|
|
|
7
|
|
|
use October\Rain\Database\Traits\Validation; |
|
|
|
|
|
|
8
|
|
|
use System\Behaviors\SettingsModel; |
|
|
|
|
|
|
9
|
|
|
|
|
10
|
|
|
/** |
|
11
|
|
|
* Class Settings |
|
12
|
|
|
* |
|
13
|
|
|
* @package GinoPane\AwesomeSocialLinks\Models |
|
14
|
|
|
*/ |
|
15
|
|
|
class Settings extends Model { |
|
16
|
|
|
use Validation; |
|
17
|
|
|
|
|
18
|
|
|
const SETTINGS_CODE = 'ginopane_awesomesociallinks'; |
|
19
|
|
|
|
|
20
|
|
|
const LINK_TARGET_BLANK = '_blank'; |
|
21
|
|
|
const LINK_TARGET_SELF = '_self'; |
|
22
|
|
|
const LINK_TARGET_PARENT = '_parent'; |
|
23
|
|
|
const LINK_TARGET_TOP = '_top'; |
|
24
|
|
|
|
|
25
|
|
|
public $implement = [SettingsModel::class]; |
|
26
|
|
|
|
|
27
|
|
|
public $settingsCode = self::SETTINGS_CODE; |
|
28
|
|
|
|
|
29
|
|
|
public $settingsFields = 'fields.yaml'; |
|
30
|
|
|
|
|
31
|
|
|
public $rules = [ |
|
32
|
|
|
'links.*.name' => 'required', |
|
33
|
|
|
'links.*.link' => 'required|url' |
|
34
|
|
|
]; |
|
35
|
|
|
|
|
36
|
|
|
public $customMessages = [ |
|
37
|
|
|
'links.*.name.required' => Plugin::LOCALIZATION_KEY . 'validation.name_required', |
|
38
|
|
|
'links.*.link.required' => Plugin::LOCALIZATION_KEY . 'validation.url_required', |
|
39
|
|
|
'links.*.link.url' => Plugin::LOCALIZATION_KEY . 'validation.url_must_be_valid' |
|
40
|
|
|
]; |
|
41
|
|
|
|
|
42
|
|
|
/** |
|
43
|
|
|
* @return LinkItem[] |
|
44
|
|
|
*/ |
|
45
|
|
|
public function getLinks(): array |
|
46
|
|
|
{ |
|
47
|
|
|
$links = []; |
|
48
|
|
|
|
|
49
|
|
|
if (!empty($this->links) && \is_array($this->links)) { |
|
50
|
|
|
foreach ($this->links as $link) { |
|
51
|
|
|
$links[] = (new LinkItem())->fillFromArray((array) $link); |
|
52
|
|
|
} |
|
53
|
|
|
} |
|
54
|
|
|
|
|
55
|
|
|
return $links; |
|
56
|
|
|
} |
|
57
|
|
|
|
|
58
|
|
|
/** |
|
59
|
|
|
* @return array |
|
60
|
|
|
*/ |
|
61
|
|
|
public function getLinkTargets(): array |
|
62
|
|
|
{ |
|
63
|
|
|
return [ |
|
64
|
|
|
self::LINK_TARGET_BLANK => self::LINK_TARGET_BLANK, |
|
65
|
|
|
self::LINK_TARGET_PARENT => self::LINK_TARGET_PARENT, |
|
66
|
|
|
self::LINK_TARGET_SELF => self::LINK_TARGET_SELF, |
|
67
|
|
|
self::LINK_TARGET_TOP => self::LINK_TARGET_TOP |
|
68
|
|
|
]; |
|
69
|
|
|
} |
|
70
|
|
|
} |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths