@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | Button::TYPE => ($hasVueRouter ? 'router-link' : 'a'), |
| 101 | 101 | Button::ATTRIBUTES => [ |
| 102 | 102 | $targetAttribute => "/{$routeBase}/edit", |
| 103 | - ] + ($hasCan ? [ "v-if" => 'can.create' ]: []), |
|
| 103 | + ] + ($hasCan ? ["v-if" => 'can.create'] : []), |
|
| 104 | 104 | ] |
| 105 | 105 | )->setContent( |
| 106 | 106 | '<i class="fa fa-plus"></i> Add new', |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | Button::TYPE => ($hasVueRouter ? 'router-link' : 'a'), |
| 115 | 115 | Button::ATTRIBUTES => [ |
| 116 | 116 | $targetAttribute => "'/{$routeBase}/' + model.{$keyAttribute} + '/edit'", |
| 117 | - ] + ($hasCan ? [ "v-if" => 'can.edit' ]: []), |
|
| 117 | + ] + ($hasCan ? ["v-if" => 'can.edit'] : []), |
|
| 118 | 118 | ] |
| 119 | 119 | )->setContent( |
| 120 | 120 | '<i class="fa fa-pencil"></i> Edit', |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | Button::ATTRIBUTES => [ |
| 131 | 131 | 'href' => '#', |
| 132 | 132 | '@click.prevent' => 'remove', |
| 133 | - ] + ($hasCan ? [ "v-if" => 'can.delete' ]: []), |
|
| 133 | + ] + ($hasCan ? ["v-if" => 'can.delete'] : []), |
|
| 134 | 134 | ] |
| 135 | 135 | )->setContent( |
| 136 | 136 | '<i class="fa fa-trash"></i> Delete', |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | $this->generator->templateParameters['options'] = $this->options; |
| 151 | 151 | |
| 152 | 152 | $this->generator->templateParameters['tableItemFields'] = |
| 153 | - array_values(array_map(function (Field $f) { |
|
| 153 | + array_values(array_map(function(Field $f) { |
|
| 154 | 154 | if ($f->getDatatype()->getBasetype() === 'relationship') { |
| 155 | 155 | $name = $f->getName(); |
| 156 | 156 | return "<{$name}-link v-bind=\"{$name}\"></{$name}-link>"; |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | 'required' => true |
| 236 | 236 | ] |
| 237 | 237 | ]; |
| 238 | - $cardFieldNames = array_map(function (Field $f) { |
|
| 238 | + $cardFieldNames = array_map(function(Field $f) { |
|
| 239 | 239 | return $f->getName(); |
| 240 | 240 | }, $this->generator->getCardFields()); |
| 241 | 241 | $vueCode->setExtraProps($extraprops); |
@@ -263,7 +263,7 @@ discard block |
||
| 263 | 263 | ] |
| 264 | 264 | ]; |
| 265 | 265 | $vueCode->setExtraProps($extraprops); |
| 266 | - $cardFieldNames = array_map(function (Field $f) { |
|
| 266 | + $cardFieldNames = array_map(function(Field $f) { |
|
| 267 | 267 | return $f->getName(); |
| 268 | 268 | }, $this->generator->getCardFields()); |
| 269 | 269 | foreach ($this->generator->getCardFields() as $f) { |
@@ -288,7 +288,7 @@ discard block |
||
| 288 | 288 | public function vueTableItem(FrameworkVue $vue): void |
| 289 | 289 | { |
| 290 | 290 | $vueCode = $vue->getVueCode(); |
| 291 | - $tableFieldNames = array_map(function (Field $f) { |
|
| 291 | + $tableFieldNames = array_map(function(Field $f) { |
|
| 292 | 292 | return $f->getName(); |
| 293 | 293 | }, $this->generator->getTableFields()); |
| 294 | 294 | $extraprops = [ |
@@ -320,7 +320,7 @@ discard block |
||
| 320 | 320 | $vue, |
| 321 | 321 | 'Form', |
| 322 | 322 | 'editable', |
| 323 | - function (Field $f) { |
|
| 323 | + function(Field $f) { |
|
| 324 | 324 | if (!$f->getExtradata('modelFillable')) { |
| 325 | 325 | return false; |
| 326 | 326 | } |
@@ -345,7 +345,7 @@ discard block |
||
| 345 | 345 | |
| 346 | 346 | if ($mode == 'editable') { |
| 347 | 347 | $vue->setEditableTemplate( |
| 348 | - function (FrameworkVue $vue, array $data, Model $m) use ($stub) { |
|
| 348 | + function(FrameworkVue $vue, array $data, Model $m) use ($stub) { |
|
| 349 | 349 | return $this->generator->templateCallback($stub, $vue, $data, $m); |
| 350 | 350 | } |
| 351 | 351 | ); |
@@ -359,7 +359,7 @@ discard block |
||
| 359 | 359 | ); |
| 360 | 360 | } else { |
| 361 | 361 | $vue->setViewableTemplate( |
| 362 | - function (FrameworkVue $vue, array $data, Model $m) use ($stub) { |
|
| 362 | + function(FrameworkVue $vue, array $data, Model $m) use ($stub) { |
|
| 363 | 363 | return $this->generator->templateCallback($stub, $vue, $data, $m); |
| 364 | 364 | } |
| 365 | 365 | ); |
@@ -391,14 +391,14 @@ discard block |
||
| 391 | 391 | ]; |
| 392 | 392 | |
| 393 | 393 | $import = array_map( |
| 394 | - function ($i) use ($name) { |
|
| 394 | + function($i) use ($name) { |
|
| 395 | 395 | return "import {$name}$i from './{$name}$i.vue';"; |
| 396 | 396 | }, |
| 397 | 397 | $items |
| 398 | 398 | ); |
| 399 | 399 | |
| 400 | 400 | $export = array_map( |
| 401 | - function ($i) use ($name) { |
|
| 401 | + function($i) use ($name) { |
|
| 402 | 402 | return " {$name}$i,"; |
| 403 | 403 | }, |
| 404 | 404 | $items |
@@ -141,17 +141,17 @@ discard block |
||
| 141 | 141 | public function buildTemplateParameters(): void |
| 142 | 142 | { |
| 143 | 143 | $this->titleFields = $this->fModel->filterField( |
| 144 | - function (Field $field) { |
|
| 144 | + function(Field $field) { |
|
| 145 | 145 | return $field->getRenderable('title', false); |
| 146 | 146 | } |
| 147 | 147 | ); |
| 148 | 148 | $this->cardFields = $this->fModel->filterField( |
| 149 | - function (Field $field) { |
|
| 149 | + function(Field $field) { |
|
| 150 | 150 | return $field->getRenderable('card', false); |
| 151 | 151 | } |
| 152 | 152 | ); |
| 153 | 153 | $this->tableFields = $this->fModel->filterField( |
| 154 | - function (Field $field) { |
|
| 154 | + function(Field $field) { |
|
| 155 | 155 | return $field->getRenderable('table', false); |
| 156 | 156 | } |
| 157 | 157 | ); |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | 'Table', |
| 208 | 208 | [ |
| 209 | 209 | Table::ROW_NAMES => array_map( |
| 210 | - function (Field $field) { |
|
| 210 | + function(Field $field) { |
|
| 211 | 211 | return $field->getRenderable(Renderable::LABEL, $field->getName()); |
| 212 | 212 | }, |
| 213 | 213 | $this->tableFields |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | true |
| 226 | 226 | ); |
| 227 | 227 | $titleFields = $this->fModel->filterField( |
| 228 | - function (Field $field) { |
|
| 228 | + function(Field $field) { |
|
| 229 | 229 | return $field->getRenderable('title', false); |
| 230 | 230 | } |
| 231 | 231 | ); |
@@ -251,7 +251,7 @@ discard block |
||
| 251 | 251 | 'keyAttribute' => $this->keyAttribute, |
| 252 | 252 | 'spinner' => $spinner, |
| 253 | 253 | 'tablelist' => $table->getRenderHTML(), |
| 254 | - 'tableItemFields' => array_keys(array_map(function (Field $f) { |
|
| 254 | + 'tableItemFields' => array_keys(array_map(function(Field $f) { |
|
| 255 | 255 | return $f->getName(); |
| 256 | 256 | }, $this->tableFields)), |
| 257 | 257 | 'typeTitle' => $this->fModel->getRenderable('name', $this->studlyName), |
@@ -327,13 +327,13 @@ discard block |
||
| 327 | 327 | $filters[] = [ |
| 328 | 328 | 'name' => $arg->name, |
| 329 | 329 | 'type' => $typename, |
| 330 | - 'graphqlType' => $arg->name . ': ' . |
|
| 330 | + 'graphqlType' => $arg->name . ': ' . |
|
| 331 | 331 | ($isArray ? '[' : '') . |
| 332 | 332 | $typename . |
| 333 | 333 | ($isInternalRequired ? '!' : '') . |
| 334 | 334 | ($isArray ? ']' : '') . |
| 335 | 335 | ($isRequired ? '!' : ''), |
| 336 | - 'required' => (bool)$isRequired, |
|
| 336 | + 'required' => (bool) $isRequired, |
|
| 337 | 337 | 'requiredJSBoolean' => $isRequired ? 'true' : 'false' |
| 338 | 338 | ]; |
| 339 | 339 | } |
@@ -349,13 +349,13 @@ discard block |
||
| 349 | 349 | * card |
| 350 | 350 | */ |
| 351 | 351 | $cardFieldNames = array_map( |
| 352 | - function (Field $field) { |
|
| 352 | + function(Field $field) { |
|
| 353 | 353 | return $field->getName(); |
| 354 | 354 | }, |
| 355 | 355 | $this->cardFields |
| 356 | 356 | ); |
| 357 | 357 | $graphqlQuery = $this->fModel->mapFields( |
| 358 | - function (Field $f) use ($cardFieldNames) { |
|
| 358 | + function(Field $f) use ($cardFieldNames) { |
|
| 359 | 359 | if (in_array($f->getName(), $cardFieldNames)) { |
| 360 | 360 | // TODO: filter subfields in relationships |
| 361 | 361 | return $f->toGraphqlQuery(); |
@@ -371,7 +371,7 @@ discard block |
||
| 371 | 371 | $filtersQuery = ', ' . join( |
| 372 | 372 | ', ', |
| 373 | 373 | array_map( |
| 374 | - function ($item) { |
|
| 374 | + function($item) { |
|
| 375 | 375 | // TODO: still buggy, misses the internal ! in [Xyz!]! |
| 376 | 376 | return '$' . $item['graphqlType']; |
| 377 | 377 | }, |
@@ -381,7 +381,7 @@ discard block |
||
| 381 | 381 | $filtersParams = ', ' . join( |
| 382 | 382 | ', ', |
| 383 | 383 | array_map( |
| 384 | - function ($item) { |
|
| 384 | + function($item) { |
|
| 385 | 385 | return $item['name'] . ': $' . $item['name']; |
| 386 | 386 | }, |
| 387 | 387 | $filters |
@@ -420,14 +420,14 @@ discard block |
||
| 420 | 420 | * table |
| 421 | 421 | */ |
| 422 | 422 | $tableFieldNames = array_map( |
| 423 | - function (Field $field) { |
|
| 423 | + function(Field $field) { |
|
| 424 | 424 | return $field->getName(); |
| 425 | 425 | }, |
| 426 | 426 | $this->tableFields |
| 427 | 427 | ); |
| 428 | 428 | |
| 429 | 429 | $graphqlQuery = $this->fModel->mapFields( |
| 430 | - function (Field $f) use ($tableFieldNames) { |
|
| 430 | + function(Field $f) use ($tableFieldNames) { |
|
| 431 | 431 | if (in_array($f->getName(), $tableFieldNames)) { |
| 432 | 432 | // TODO: filter subfields in relationships |
| 433 | 433 | return $f->toGraphqlQuery(); |
@@ -467,7 +467,7 @@ discard block |
||
| 467 | 467 | * item |
| 468 | 468 | */ |
| 469 | 469 | $graphqlQuery = $this->fModel->mapFields( |
| 470 | - function (Field $f) { |
|
| 470 | + function(Field $f) { |
|
| 471 | 471 | return \Modelarium\Frontend\Util::fieldShow($f) ? $f->toGraphqlQuery() : null; |
| 472 | 472 | } |
| 473 | 473 | ); |