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) 2017 nystudio107 |
||
10 | */ |
||
11 | |||
12 | namespace nystudio107\seomatic\controllers; |
||
13 | |||
14 | use Craft; |
||
15 | use craft\base\Element; |
||
16 | use craft\elements\Entry; |
||
17 | use craft\web\Controller; |
||
18 | use nystudio107\seomatic\assetbundles\seomatic\SeomaticAsset; |
||
19 | use nystudio107\seomatic\helpers\PluginTemplate; |
||
20 | use nystudio107\seomatic\Seomatic; |
||
21 | |||
22 | /** |
||
23 | * @author nystudio107 |
||
24 | * @package Seomatic |
||
25 | * @since 3.2.13 |
||
26 | */ |
||
27 | class PreviewController extends Controller |
||
28 | { |
||
29 | // Properties |
||
30 | // ========================================================================= |
||
31 | |||
32 | /** |
||
33 | * @inheritdoc |
||
34 | */ |
||
35 | protected array|bool|int $allowAnonymous = [ |
||
36 | 'social-media', |
||
37 | ]; |
||
38 | |||
39 | // Public Methods |
||
40 | // ========================================================================= |
||
41 | |||
42 | /** |
||
43 | * @param $elementId |
||
44 | * @param $siteId |
||
45 | * |
||
46 | * @return \yii\web\Response |
||
47 | * @throws \yii\web\BadRequestHttpException |
||
48 | * @throws \yii\base\InvalidConfigException |
||
49 | * @throws \yii\web\ForbiddenHttpException |
||
50 | */ |
||
51 | public function actionSocialMedia($elementId, $siteId = null) |
||
52 | { |
||
53 | $html = ''; |
||
54 | |||
55 | // Don't allow the preview to be accessed publicly |
||
56 | $this->requireAuthorization(Seomatic::SEOMATIC_PREVIEW_AUTHORIZATION_KEY . $elementId); |
||
57 | |||
58 | /** @var Element $element */ |
||
59 | $element = Craft::$app->getElements()->getElementById($elementId, null, $siteId); |
||
60 | if ($element !== null) { |
||
61 | Seomatic::$view->registerAssetBundle(SeomaticAsset::class); |
||
0 ignored issues
–
show
|
|||
62 | /** @var $entry Entry */ |
||
63 | if ($element->uri !== null) { |
||
64 | Seomatic::$plugin->metaContainers->previewMetaContainers($element->uri, $element->siteId, true); |
||
65 | // Render our preview sidebar template |
||
66 | if (Seomatic::$matchedElement) { |
||
67 | $html = PluginTemplate::renderPluginTemplate('_frontend/preview/social-media.twig'); |
||
68 | } |
||
69 | } |
||
70 | } |
||
71 | |||
72 | return $this->asRaw($html); |
||
73 | } |
||
74 | } |
||
75 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.