|
4 | 4 |
|
5 | 5 | namespace CraftCms\Cms\Http\Controllers; |
6 | 6 |
|
| 7 | +use Craft; |
7 | 8 | use craft\base\ElementInterface; |
8 | 9 | use CraftCms\Cms\Http\EnforcesPermissions; |
9 | 10 | use CraftCms\Cms\Http\RespondsWithFlash; |
@@ -36,15 +37,15 @@ public function __construct( |
36 | 37 | 'siteId' => ['required', 'integer'], |
37 | 38 | ]); |
38 | 39 |
|
39 | | - $this->requirePermission("editStructure:$structureId"); |
| 40 | + $this->requireSessionAuthorization("editStructure:$structureId"); |
40 | 41 |
|
41 | 42 | abort_if( |
42 | 43 | is_null($this->structure = $structures->getStructureById($structureId)), |
43 | 44 | 404, |
44 | 45 | 'Structure not found.' |
45 | 46 | ); |
46 | 47 |
|
47 | | - $elementsService = \Craft::$app->getElements(); |
| 48 | + $elementsService = Craft::$app->getElements(); |
48 | 49 |
|
49 | 50 | abort_if( |
50 | 51 | is_null($elementType = $elementsService->getElementTypeById($elementId)), |
@@ -77,10 +78,10 @@ public function moveElement(): Response |
77 | 78 | $prevElementId = $this->request->input('prevId'); |
78 | 79 |
|
79 | 80 | if ($prevElementId) { |
80 | | - $prevElement = \Craft::$app->getElements()->getElementById($prevElementId, null, $this->element->siteId); |
| 81 | + $prevElement = Craft::$app->getElements()->getElementById($prevElementId, null, $this->element->siteId); |
81 | 82 | $success = $this->structures->moveAfter($this->structure->id, $this->element, $prevElement); |
82 | 83 | } elseif ($parentElementId) { |
83 | | - $parentElement = \Craft::$app->getElements()->getElementById($parentElementId, null, $this->element->siteId); |
| 84 | + $parentElement = Craft::$app->getElements()->getElementById($parentElementId, null, $this->element->siteId); |
84 | 85 | $success = $this->structures->prepend($this->structure->id, $this->element, $parentElement); |
85 | 86 | } else { |
86 | 87 | $success = $this->structures->prependToRoot($this->structure->id, $this->element); |
|
0 commit comments