1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* SEOmatic plugin for Craft CMS |
4
|
|
|
* |
5
|
|
|
* @link https://nystudio107.com/ |
6
|
|
|
* @copyright Copyright (c) 2017 nystudio107 |
7
|
|
|
* @license https://nystudio107.com/license |
8
|
|
|
*/ |
9
|
|
|
|
10
|
|
|
namespace nystudio107\seomatic\fields; |
11
|
|
|
|
12
|
|
|
use Craft; |
13
|
|
|
use craft\base\ElementInterface; |
|
|
|
|
14
|
|
|
use craft\base\Field; |
15
|
|
|
use craft\helpers\Json; |
16
|
|
|
use yii\db\Schema; |
17
|
|
|
use function is_string; |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* @author nystudio107 |
21
|
|
|
* @package Seomatic |
22
|
|
|
* @since 3.0.0 |
23
|
|
|
*/ |
24
|
|
|
class Seomatic_Meta extends Field |
25
|
|
|
{ |
26
|
|
|
// Public Properties |
27
|
|
|
// ========================================================================= |
28
|
|
|
|
29
|
|
|
public $assetSources = []; |
30
|
|
|
public $seoMainEntityCategory = ''; |
31
|
|
|
public $seoMainEntityOfPage = ''; |
32
|
|
|
public $seoTitleSource = ''; |
33
|
|
|
public $seoTitleSourceField = ''; |
34
|
|
|
public $seoTitle = ''; |
35
|
|
|
public $seoTitleSourceChangeable = true; |
36
|
|
|
public $seoDescriptionSource = ''; |
37
|
|
|
public $seoDescriptionSourceField = ''; |
38
|
|
|
public $seoDescription = ''; |
39
|
|
|
public $seoDescriptionSourceChangeable = true; |
40
|
|
|
public $seoKeywordsSource = ''; |
41
|
|
|
public $seoKeywordsSourceField = ''; |
42
|
|
|
public $seoKeywords = ''; |
43
|
|
|
public $seoKeywordsSourceChangeable = true; |
44
|
|
|
public $seoImageIdSource = ''; |
45
|
|
|
public $seoImageIdSourceField = ''; |
46
|
|
|
public $seoImageIdSourceChangeable = true; |
47
|
|
|
public $seoImageTransform = ''; |
48
|
|
|
public $twitterCardType = ''; |
49
|
|
|
public $twitterCardTypeChangeable = true; |
50
|
|
|
public $seoTwitterImageIdSource = ''; |
51
|
|
|
public $seoTwitterImageIdSourceField = ''; |
52
|
|
|
public $seoTwitterImageIdSourceChangeable = true; |
53
|
|
|
public $seoTwitterImageTransform = ''; |
54
|
|
|
public $openGraphType = ''; |
55
|
|
|
public $openGraphTypeChangeable = true; |
56
|
|
|
public $seoFacebookImageIdSource = ''; |
57
|
|
|
public $seoFacebookImageIdSourceField = ''; |
58
|
|
|
public $seoFacebookImageIdSourceChangeable = true; |
59
|
|
|
public $seoFacebookImageTransform = ''; |
60
|
|
|
public $robots = ''; |
61
|
|
|
public $robotsChangeable = true; |
62
|
|
|
|
63
|
|
|
// Static Methods |
64
|
|
|
// ========================================================================= |
65
|
|
|
|
66
|
|
|
/** |
67
|
|
|
* @inheritdoc |
68
|
|
|
*/ |
69
|
|
|
public static function dbType(): array|string|null |
70
|
|
|
{ |
71
|
|
|
return Schema::TYPE_TEXT; |
72
|
|
|
} |
73
|
|
|
|
74
|
|
|
/** |
75
|
|
|
* @inheritdoc |
76
|
|
|
*/ |
77
|
|
|
public static function displayName(): string |
78
|
|
|
{ |
79
|
|
|
return Craft::t('seomatic', 'SEOmatic Meta (deprecated)'); |
80
|
|
|
} |
81
|
|
|
|
82
|
|
|
/** |
83
|
|
|
* @inheritdoc |
84
|
|
|
*/ |
85
|
|
|
public static function isSelectable(): bool |
86
|
|
|
{ |
87
|
|
|
return false; |
88
|
|
|
} |
89
|
|
|
|
90
|
|
|
// Public Methods |
91
|
|
|
// ========================================================================= |
92
|
|
|
|
93
|
|
|
/** |
94
|
|
|
* @inheritdoc |
95
|
|
|
*/ |
96
|
|
|
public function rules(): array |
97
|
|
|
{ |
98
|
|
|
$rules = parent::rules(); |
99
|
|
|
$rules = array_merge($rules, [ |
100
|
|
|
]); |
101
|
|
|
|
102
|
|
|
return $rules; |
103
|
|
|
} |
104
|
|
|
|
105
|
|
|
/** |
106
|
|
|
* @inheritdoc |
107
|
|
|
*/ |
108
|
|
|
public function normalizeValue(mixed $value, ?ElementInterface $element = null): mixed |
109
|
|
|
{ |
110
|
|
|
if (!empty($value)) { |
111
|
|
|
if (is_string($value)) { |
112
|
|
|
$value = Json::decodeIfJson($value); |
113
|
|
|
} |
114
|
|
|
} |
115
|
|
|
|
116
|
|
|
return $value; |
117
|
|
|
} |
118
|
|
|
|
119
|
|
|
/** |
120
|
|
|
* @inheritdoc |
121
|
|
|
*/ |
122
|
|
|
public function getSettingsHtml(): ?string |
123
|
|
|
{ |
124
|
|
|
return '<p>The SEOmatic Meta field type is deprecated in Craft 3. Use the SEO Settings field instead.</p>'; |
125
|
|
|
} |
126
|
|
|
|
127
|
|
|
/** |
128
|
|
|
* @inheritdoc |
129
|
|
|
*/ |
130
|
|
|
public function getInputHtml(mixed $value, ?ElementInterface $element = null): string |
131
|
|
|
{ |
132
|
|
|
return ''; |
133
|
|
|
} |
134
|
|
|
} |
135
|
|
|
|
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