@@ -104,8 +104,7 @@ |
||
| 104 | 104 | if ($this->matrixBlockType) |
| 105 | 105 | { |
| 106 | 106 | return $this->matrixBlockType; |
| 107 | - } |
|
| 108 | - else |
|
| 107 | + } else |
|
| 109 | 108 | { |
| 110 | 109 | return Craft::$app->matrix->getBlockTypeById($this->matrixBlockTypeId); |
| 111 | 110 | } |
@@ -154,8 +154,7 @@ |
||
| 154 | 154 | if (!$spoonedBlockType = Spoon::$plugin->blockTypes->getById($spoonedBlockTypeId)) { |
| 155 | 155 | return false; |
| 156 | 156 | } |
| 157 | - } |
|
| 158 | - else |
|
| 157 | + } else |
|
| 159 | 158 | { |
| 160 | 159 | return false; |
| 161 | 160 | } |
@@ -38,18 +38,18 @@ |
||
| 38 | 38 | // Public Static Methods |
| 39 | 39 | // ========================================================================= |
| 40 | 40 | |
| 41 | - /** |
|
| 42 | - * Declares the name of the database table associated with this AR class. |
|
| 43 | - * By default this method returns the class name as the table name by calling [[Inflector::camel2id()]] |
|
| 44 | - * with prefix [[Connection::tablePrefix]]. For example if [[Connection::tablePrefix]] is `tbl_`, |
|
| 45 | - * `Customer` becomes `tbl_customer`, and `OrderItem` becomes `tbl_order_item`. You may override this method |
|
| 46 | - * if the table is not named after this convention. |
|
| 47 | - * |
|
| 48 | - * By convention, tables created by plugins should be prefixed with the plugin |
|
| 49 | - * name and an underscore. |
|
| 50 | - * |
|
| 51 | - * @return string the table name |
|
| 52 | - */ |
|
| 41 | + /** |
|
| 42 | + * Declares the name of the database table associated with this AR class. |
|
| 43 | + * By default this method returns the class name as the table name by calling [[Inflector::camel2id()]] |
|
| 44 | + * with prefix [[Connection::tablePrefix]]. For example if [[Connection::tablePrefix]] is `tbl_`, |
|
| 45 | + * `Customer` becomes `tbl_customer`, and `OrderItem` becomes `tbl_order_item`. You may override this method |
|
| 46 | + * if the table is not named after this convention. |
|
| 47 | + * |
|
| 48 | + * By convention, tables created by plugins should be prefixed with the plugin |
|
| 49 | + * name and an underscore. |
|
| 50 | + * |
|
| 51 | + * @return string the table name |
|
| 52 | + */ |
|
| 53 | 53 | public static function tableName() |
| 54 | 54 | { |
| 55 | 55 | return '{{%spoon_blocktypes}}'; |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | { |
| 38 | 38 | |
| 39 | 39 | // Check the conditions are right to run |
| 40 | - if ( Craft::$app->request->isCpRequest && !Craft::$app->request->getAcceptsJson()) |
|
| 40 | + if (Craft::$app->request->isCpRequest && !Craft::$app->request->getAcceptsJson()) |
|
| 41 | 41 | { |
| 42 | 42 | |
| 43 | 43 | $segments = Craft::$app->request->getSegments(); |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | * Work out the context for the block type groups configuration |
| 47 | 47 | */ |
| 48 | 48 | // Entry types |
| 49 | - if ( count($segments) == 5 |
|
| 49 | + if (count($segments) == 5 |
|
| 50 | 50 | && $segments[0] == 'settings' |
| 51 | 51 | && $segments[1] == 'sections' |
| 52 | 52 | && $segments[3] == 'entrytypes' |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | // Category groups |
| 60 | - if ( count($segments) == 3 |
|
| 60 | + if (count($segments) == 3 |
|
| 61 | 61 | && $segments[0] == 'settings' |
| 62 | 62 | && $segments[1] == 'categories' |
| 63 | 63 | && $segments[2] != 'new' |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | // Global sets |
| 70 | - if ( count($segments) == 3 |
|
| 70 | + if (count($segments) == 3 |
|
| 71 | 71 | && $segments[0] == 'settings' |
| 72 | 72 | && $segments[1] == 'globals' |
| 73 | 73 | && $segments[2] != 'new' |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | // Users |
| 80 | - if ( count($segments) == 2 |
|
| 80 | + if (count($segments) == 2 |
|
| 81 | 81 | && $segments[0] == 'settings' |
| 82 | 82 | && $segments[1] == 'users' |
| 83 | 83 | ) |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | $context = 'global'; |
| 93 | 93 | |
| 94 | 94 | // Entry types |
| 95 | - if ( count($segments) >= 3 && $segments[0] == 'entries' ) |
|
| 95 | + if (count($segments) >= 3 && $segments[0] == 'entries') |
|
| 96 | 96 | { |
| 97 | 97 | |
| 98 | 98 | if ($segments[2] == 'new') |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | } |
| 104 | 104 | else |
| 105 | 105 | { |
| 106 | - $entryId = explode('-',$segments[2])[0]; |
|
| 106 | + $entryId = explode('-', $segments[2])[0]; |
|
| 107 | 107 | $entry = Craft::$app->entries->getEntryById($entryId); |
| 108 | 108 | |
| 109 | 109 | if ($entry) |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | |
| 119 | 119 | } |
| 120 | 120 | // Category groups |
| 121 | - else if ( count($segments) >= 3 && $segments[0] == 'categories' ) |
|
| 121 | + else if (count($segments) >= 3 && $segments[0] == 'categories') |
|
| 122 | 122 | { |
| 123 | 123 | $group = Craft::$app->categories->getGroupByHandle($segments[1]); |
| 124 | 124 | if ($group) |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | } |
| 128 | 128 | } |
| 129 | 129 | // Global sets |
| 130 | - else if ( count($segments) >= 2 && $segments[0] == 'globals' ) |
|
| 130 | + else if (count($segments) >= 2 && $segments[0] == 'globals') |
|
| 131 | 131 | { |
| 132 | 132 | $set = Craft::$app->globals->getSetByHandle(end($segments)); |
| 133 | 133 | if ($set) |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | } |
| 137 | 137 | } |
| 138 | 138 | // Users |
| 139 | - else if ( (count($segments) == 1 && $segments[0] == 'myaccount') || (count($segments) == 2 && $segments[0] == 'users') ) |
|
| 139 | + else if ((count($segments) == 1 && $segments[0] == 'myaccount') || (count($segments) == 2 && $segments[0] == 'users')) |
|
| 140 | 140 | { |
| 141 | 141 | $context = 'users'; |
| 142 | 142 | } |
@@ -100,8 +100,7 @@ |
||
| 100 | 100 | $section = Craft::$app->sections->getSectionByHandle($segments[1]); |
| 101 | 101 | $sectionEntryTypes = $section->getEntryTypes(); |
| 102 | 102 | $entryType = reset($sectionEntryTypes); |
| 103 | - } |
|
| 104 | - else |
|
| 103 | + } else |
|
| 105 | 104 | { |
| 106 | 105 | $entryId = explode('-',$segments[2])[0]; |
| 107 | 106 | $entry = Craft::$app->entries->getEntryById($entryId); |
@@ -261,12 +261,12 @@ |
||
| 261 | 261 | } |
| 262 | 262 | |
| 263 | 263 | $affectedRows = Craft::$app->getDb()->createCommand() |
| 264 | - ->delete('{{%spoon_blocktypes}}',$condition) |
|
| 264 | + ->delete('{{%spoon_blocktypes}}', $condition) |
|
| 265 | 265 | ->execute(); |
| 266 | 266 | |
| 267 | 267 | $transaction->commit(); |
| 268 | 268 | |
| 269 | - return (bool) $affectedRows; |
|
| 269 | + return (bool)$affectedRows; |
|
| 270 | 270 | } catch (\Exception $e) { |
| 271 | 271 | $transaction->rollBack(); |
| 272 | 272 | throw $e; |
@@ -120,8 +120,7 @@ discard block |
||
| 120 | 120 | |
| 121 | 121 | $blockTypeRecords = BlockTypeRecord::find()->where($condition)->all(); |
| 122 | 122 | |
| 123 | - } |
|
| 124 | - else |
|
| 123 | + } else |
|
| 125 | 124 | { |
| 126 | 125 | $condition = [ |
| 127 | 126 | 'context' => $context |
@@ -145,8 +144,7 @@ discard block |
||
| 145 | 144 | $this->_blockTypesByContext[$context][$blockType->id] = $blockType; |
| 146 | 145 | } |
| 147 | 146 | |
| 148 | - } |
|
| 149 | - else |
|
| 147 | + } else |
|
| 150 | 148 | { |
| 151 | 149 | return []; |
| 152 | 150 | } |
@@ -160,8 +158,7 @@ discard block |
||
| 160 | 158 | $return[$blockType->$groupBy][] = $blockType; |
| 161 | 159 | } |
| 162 | 160 | return $return; |
| 163 | - } |
|
| 164 | - else |
|
| 161 | + } else |
|
| 165 | 162 | { |
| 166 | 163 | return $this->_blockTypesByContext[$context]; |
| 167 | 164 | } |
@@ -188,8 +185,7 @@ discard block |
||
| 188 | 185 | { |
| 189 | 186 | throw new Exception(Craft::t('No Spoon Block Type exists with the ID “{id}”', ['id' => $blockType->id])); |
| 190 | 187 | } |
| 191 | - } |
|
| 192 | - else |
|
| 188 | + } else |
|
| 193 | 189 | { |
| 194 | 190 | $blockTypeRecord = new BlockTypeRecord(); |
| 195 | 191 | } |
@@ -327,8 +323,7 @@ discard block |
||
| 327 | 323 | // spooned blocktype model |
| 328 | 324 | $spoonedBlockType->fieldLayoutId = $layout->id; |
| 329 | 325 | |
| 330 | - } |
|
| 331 | - else |
|
| 326 | + } else |
|
| 332 | 327 | { |
| 333 | 328 | $spoonedBlockType->fieldLayoutId = null; |
| 334 | 329 | } |