Issues (245)

src/base/SeoElementInterface.php (1 issue)

Labels
Severity
1
<?php
2
/**
3
 * SEOmatic plugin for Craft CMS
4
 *
5
 * A turnkey SEO implementation for Craft CMS that is comprehensive, powerful,
6
 * and flexible
7
 *
8
 * @link      https://nystudio107.com
9
 * @copyright Copyright (c) 2019 nystudio107
10
 */
11
12
namespace nystudio107\seomatic\base;
13
14
use craft\base\ElementInterface;
0 ignored issues
show
The type craft\base\ElementInterface was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
15
use craft\base\Model;
16
use craft\elements\db\ElementQueryInterface;
17
use nystudio107\seomatic\models\MetaBundle;
18
19
/**
20
 * @author    nystudio107
21
 * @package   Seomatic
22
 * @since     3.2.0
23
 */
24
interface SeoElementInterface
25
{
26
    // Public Static Methods
27
    // =========================================================================
28
29
    /**
30
     * Return the sourceBundleType for that this SeoElement handles
31
     *
32
     * @return string
33
     */
34
    public static function getMetaBundleType(): string;
35
36
    /**
37
     * Returns an array of the element classes that are handled by this SeoElement
38
     *
39
     * @return array
40
     */
41
    public static function getElementClasses(): array;
42
43
    /**
44
     * Return the refHandle (e.g.: `entry` or `category`) for the SeoElement
45
     *
46
     * @return string
47
     */
48
    public static function getElementRefHandle(): string;
49
50
    /**
51
     * Return the handle to a required plugin for this SeoElement type
52
     *
53
     * @return null|string
54
     */
55
    public static function getRequiredPluginHandle();
56
57
    /**
58
     * Install any event handlers for this SeoElement type
59
     */
60
    public static function installEventHandlers();
61
62
    /**
63
     * Return an ElementQuery for the sitemap elements for the given MetaBundle
64
     *
65
     * @param MetaBundle $metaBundle
66
     *
67
     * @return ElementQueryInterface
68
     */
69
    public static function sitemapElementsQuery(MetaBundle $metaBundle): ElementQueryInterface;
70
71
    /**
72
     * Return an ElementInterface for the sitemap alt element for the given MetaBundle
73
     * and Element ID
74
     *
75
     * @param MetaBundle $metaBundle
76
     * @param int $elementId
77
     * @param int $siteId
78
     *
79
     * @return null|ElementInterface
80
     */
81
    public static function sitemapAltElement(
82
        MetaBundle $metaBundle,
83
        int        $elementId,
84
        int        $siteId,
85
    );
86
87
    /**
88
     * Return a preview URI for a given $sourceHandle and $siteId
89
     * This just returns the first element
90
     *
91
     * @param string $sourceHandle
92
     * @param int|null $siteId
93
     * @param int|string|null $typeId
94
     *
95
     * @return ?string
96
     */
97
    public static function previewUri(string $sourceHandle, $siteId, $typeId = null): ?string;
98
99
    /**
100
     * Return an array of FieldLayouts from the $sourceHandle
101
     *
102
     * @param string $sourceHandle
103
     * @param int|string|null $typeId
104
     *
105
     * @return array
106
     */
107
    public static function fieldLayouts(string $sourceHandle, $typeId = null): array;
108
109
    /**
110
     * Return the (entry) type menu as a $id => $name associative array
111
     *
112
     * @param string $sourceHandle
113
     *
114
     * @return array
115
     */
116
    public static function typeMenuFromHandle(string $sourceHandle): array;
117
118
    /**
119
     * Return the source model of the given $sourceId
120
     *
121
     * @param int $sourceId
122
     *
123
     * @return Model|null
124
     */
125
    public static function sourceModelFromId(int $sourceId);
126
127
    /**
128
     * Return the source model of the given $sourceId
129
     *
130
     * @param string $sourceHandle
131
     *
132
     * @return Model|null
133
     */
134
    public static function sourceModelFromHandle(string $sourceHandle);
135
136
    /**
137
     * Return the most recently updated Element from a given source model
138
     *
139
     * @param Model $sourceModel
140
     * @param int $sourceSiteId
141
     *
142
     * @return null|ElementInterface
143
     */
144
    public static function mostRecentElement(Model $sourceModel, int $sourceSiteId);
145
146
    /**
147
     * Return the path to the config file directory
148
     *
149
     * @return string
150
     */
151
    public static function configFilePath(): string;
152
153
    /**
154
     * Return a meta bundle config array for the given $sourceModel
155
     *
156
     * @param Model $sourceModel
157
     *
158
     * @return array
159
     */
160
    public static function metaBundleConfig(Model $sourceModel): array;
161
162
    /**
163
     * Return the source id from the $element
164
     *
165
     * @param ElementInterface $element
166
     *
167
     * @return int|null
168
     */
169
    public static function sourceIdFromElement(ElementInterface $element);
170
171
    /**
172
     * Return the (entry) type id from the $element
173
     *
174
     * @param ElementInterface $element
175
     *
176
     * @return int|null
177
     */
178
    public static function typeIdFromElement(ElementInterface $element);
179
180
    /**
181
     * Return the source handle from the $element
182
     *
183
     * @param ElementInterface $element
184
     *
185
     * @return string|null
186
     */
187
    public static function sourceHandleFromElement(ElementInterface $element);
188
189
    /**
190
     * Create a MetaBundle in the db for each site, from the passed in $sourceModel
191
     *
192
     * @param Model $sourceModel
193
     */
194
    public static function createContentMetaBundle(Model $sourceModel);
195
196
    /**
197
     * Create all the MetaBundles in the db for this Seo Element
198
     */
199
    public static function createAllContentMetaBundles();
200
}
201