@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | Button::TYPE => ($hasVueRouter ? 'router-link' : 'a'), |
| 124 | 124 | Button::ATTRIBUTES => [ |
| 125 | 125 | $targetAttribute => "/{$routeBase}/edit", |
| 126 | - ] + ($hasCan ? [ "v-if" => 'can.create' ]: []), |
|
| 126 | + ] + ($hasCan ? ["v-if" => 'can.create'] : []), |
|
| 127 | 127 | ] |
| 128 | 128 | )->setContent( |
| 129 | 129 | '<i class="fa fa-plus"></i> Add new', |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | Button::TYPE => ($hasVueRouter ? 'router-link' : 'a'), |
| 138 | 138 | Button::ATTRIBUTES => [ |
| 139 | 139 | $targetAttribute => "'/{$routeBase}/' + model.{$keyAttribute} + '/edit'", |
| 140 | - ] + ($hasCan ? [ "v-if" => 'can.edit' ]: []), |
|
| 140 | + ] + ($hasCan ? ["v-if" => 'can.edit'] : []), |
|
| 141 | 141 | ] |
| 142 | 142 | )->setContent( |
| 143 | 143 | '<i class="fa fa-pencil"></i> Edit', |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | Button::ATTRIBUTES => [ |
| 154 | 154 | 'href' => '#', |
| 155 | 155 | '@click.prevent' => 'remove', |
| 156 | - ] + ($hasCan ? [ "v-if" => 'can.delete' ]: []), |
|
| 156 | + ] + ($hasCan ? ["v-if" => 'can.delete'] : []), |
|
| 157 | 157 | ] |
| 158 | 158 | )->setContent( |
| 159 | 159 | '<i class="fa fa-trash"></i> Delete', |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | $this->generator->templateParameters['options'] = $this->options->getSection('vue'); |
| 174 | 174 | |
| 175 | 175 | $this->generator->templateParameters['tableItemFields'] = |
| 176 | - array_values(array_map(function (Field $f) { |
|
| 176 | + array_values(array_map(function(Field $f) { |
|
| 177 | 177 | if ($f->getDatatype()->getBasetype() === 'relationship') { |
| 178 | 178 | $name = $f->getName(); |
| 179 | 179 | return "<{$name}-link v-bind=\"{$name}\"></{$name}-link>"; |
@@ -258,7 +258,7 @@ discard block |
||
| 258 | 258 | 'required' => true |
| 259 | 259 | ] |
| 260 | 260 | ]; |
| 261 | - $cardFieldNames = array_map(function (Field $f) { |
|
| 261 | + $cardFieldNames = array_map(function(Field $f) { |
|
| 262 | 262 | return $f->getName(); |
| 263 | 263 | }, $this->generator->getCardFields()); |
| 264 | 264 | $vueCode->setExtraProps($extraprops); |
@@ -291,7 +291,7 @@ discard block |
||
| 291 | 291 | ] |
| 292 | 292 | ]; |
| 293 | 293 | $vueCode->setExtraProps($extraprops); |
| 294 | - $cardFieldNames = array_map(function (Field $f) { |
|
| 294 | + $cardFieldNames = array_map(function(Field $f) { |
|
| 295 | 295 | return $f->getName(); |
| 296 | 296 | }, $this->generator->getCardFields()); |
| 297 | 297 | foreach ($this->generator->getCardFields() as $f) { |
@@ -316,7 +316,7 @@ discard block |
||
| 316 | 316 | public function vueTableItem(FrameworkVue $vue): void |
| 317 | 317 | { |
| 318 | 318 | $vueCode = $vue->getVueCode(); |
| 319 | - $tableFieldNames = array_map(function (Field $f) { |
|
| 319 | + $tableFieldNames = array_map(function(Field $f) { |
|
| 320 | 320 | return $f->getName(); |
| 321 | 321 | }, $this->generator->getTableFields()); |
| 322 | 322 | $extraprops = [ |
@@ -348,7 +348,7 @@ discard block |
||
| 348 | 348 | $vue, |
| 349 | 349 | 'Form', |
| 350 | 350 | 'editable', |
| 351 | - function (Field $f) { |
|
| 351 | + function(Field $f) { |
|
| 352 | 352 | if (!$f->getExtradata('modelFillable')) { |
| 353 | 353 | return false; |
| 354 | 354 | } |
@@ -373,7 +373,7 @@ discard block |
||
| 373 | 373 | |
| 374 | 374 | if ($mode == 'editable') { |
| 375 | 375 | $vue->setEditableTemplate( |
| 376 | - function (FrameworkVue $vue, array $data, Model $m) use ($stub) { |
|
| 376 | + function(FrameworkVue $vue, array $data, Model $m) use ($stub) { |
|
| 377 | 377 | return $this->generator->templateCallback($stub, $vue, $data, $m); |
| 378 | 378 | } |
| 379 | 379 | ); |
@@ -387,7 +387,7 @@ discard block |
||
| 387 | 387 | ); |
| 388 | 388 | } else { |
| 389 | 389 | $vue->setViewableTemplate( |
| 390 | - function (FrameworkVue $vue, array $data, Model $m) use ($stub) { |
|
| 390 | + function(FrameworkVue $vue, array $data, Model $m) use ($stub) { |
|
| 391 | 391 | return $this->generator->templateCallback($stub, $vue, $data, $m); |
| 392 | 392 | } |
| 393 | 393 | ); |
@@ -409,7 +409,7 @@ discard block |
||
| 409 | 409 | $path = $this->generator->getModel()->getName() . '/index.js'; |
| 410 | 410 | $name = $this->generator->getStudlyName(); |
| 411 | 411 | |
| 412 | - $contents = function ($basepath, $element) use ($name) { |
|
| 412 | + $contents = function($basepath, $element) use ($name) { |
|
| 413 | 413 | $dir = $basepath . '/' . $name; |
| 414 | 414 | $import = []; |
| 415 | 415 | $export = []; |
@@ -142,17 +142,17 @@ discard block |
||
| 142 | 142 | public function buildTemplateParameters(): void |
| 143 | 143 | { |
| 144 | 144 | $this->titleFields = $this->fModel->filterField( |
| 145 | - function (Field $field) { |
|
| 145 | + function(Field $field) { |
|
| 146 | 146 | return $field->getRenderable('title', false); |
| 147 | 147 | } |
| 148 | 148 | ); |
| 149 | 149 | $this->cardFields = $this->fModel->filterField( |
| 150 | - function (Field $field) { |
|
| 150 | + function(Field $field) { |
|
| 151 | 151 | return $field->getRenderable('card', false); |
| 152 | 152 | } |
| 153 | 153 | ); |
| 154 | 154 | $this->tableFields = $this->fModel->filterField( |
| 155 | - function (Field $field) { |
|
| 155 | + function(Field $field) { |
|
| 156 | 156 | return $field->getRenderable('table', false); |
| 157 | 157 | } |
| 158 | 158 | ); |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | 'Table', |
| 209 | 209 | [ |
| 210 | 210 | Table::ROW_NAMES => array_map( |
| 211 | - function (Field $field) { |
|
| 211 | + function(Field $field) { |
|
| 212 | 212 | return $field->getRenderable(Renderable::LABEL, $field->getName()); |
| 213 | 213 | }, |
| 214 | 214 | $this->tableFields |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | true |
| 227 | 227 | ); |
| 228 | 228 | $titleFields = $this->fModel->filterField( |
| 229 | - function (Field $field) { |
|
| 229 | + function(Field $field) { |
|
| 230 | 230 | return $field->getRenderable('title', false); |
| 231 | 231 | } |
| 232 | 232 | ); |
@@ -252,7 +252,7 @@ discard block |
||
| 252 | 252 | 'keyAttribute' => $this->keyAttribute, |
| 253 | 253 | 'spinner' => $spinner, |
| 254 | 254 | 'tablelist' => $table->getRenderHTML(), |
| 255 | - 'tableItemFields' => array_keys(array_map(function (Field $f) { |
|
| 255 | + 'tableItemFields' => array_keys(array_map(function(Field $f) { |
|
| 256 | 256 | return $f->getName(); |
| 257 | 257 | }, $this->tableFields)), |
| 258 | 258 | 'typeTitle' => $this->fModel->getRenderable('name', $this->studlyName), |
@@ -330,13 +330,13 @@ discard block |
||
| 330 | 330 | $filters[] = [ |
| 331 | 331 | 'name' => $arg->name, |
| 332 | 332 | 'type' => $typename, |
| 333 | - 'graphqlType' => $arg->name . ': ' . |
|
| 333 | + 'graphqlType' => $arg->name . ': ' . |
|
| 334 | 334 | ($isArray ? '[' : '') . |
| 335 | 335 | $typename . |
| 336 | 336 | $isInternalRequiredString . // TODO: phpstan complains, issue with graphqlphp ($isInternalRequired ? '!' : '') . |
| 337 | 337 | ($isArray ? ']' : '') . |
| 338 | 338 | ($isRequired ? '!' : ''), |
| 339 | - 'required' => (bool)$isRequired, |
|
| 339 | + 'required' => (bool) $isRequired, |
|
| 340 | 340 | 'requiredJSBoolean' => $isRequired ? 'true' : 'false' |
| 341 | 341 | ]; |
| 342 | 342 | } |
@@ -352,13 +352,13 @@ discard block |
||
| 352 | 352 | * card |
| 353 | 353 | */ |
| 354 | 354 | $cardFieldNames = array_map( |
| 355 | - function (Field $field) { |
|
| 355 | + function(Field $field) { |
|
| 356 | 356 | return $field->getName(); |
| 357 | 357 | }, |
| 358 | 358 | $this->cardFields |
| 359 | 359 | ); |
| 360 | 360 | $graphqlQuery = $this->fModel->mapFields( |
| 361 | - function (Field $f) use ($cardFieldNames) { |
|
| 361 | + function(Field $f) use ($cardFieldNames) { |
|
| 362 | 362 | if (in_array($f->getName(), $cardFieldNames)) { |
| 363 | 363 | // TODO: filter subfields in relationships |
| 364 | 364 | return $f->toGraphqlQuery(); |
@@ -374,7 +374,7 @@ discard block |
||
| 374 | 374 | $filtersQuery = ', ' . join( |
| 375 | 375 | ', ', |
| 376 | 376 | array_map( |
| 377 | - function ($item) { |
|
| 377 | + function($item) { |
|
| 378 | 378 | // TODO: still buggy, misses the internal ! in [Xyz!]! |
| 379 | 379 | return '$' . $item['graphqlType']; |
| 380 | 380 | }, |
@@ -384,7 +384,7 @@ discard block |
||
| 384 | 384 | $filtersParams = ', ' . join( |
| 385 | 385 | ', ', |
| 386 | 386 | array_map( |
| 387 | - function ($item) { |
|
| 387 | + function($item) { |
|
| 388 | 388 | return $item['name'] . ': $' . $item['name']; |
| 389 | 389 | }, |
| 390 | 390 | $filters |
@@ -423,14 +423,14 @@ discard block |
||
| 423 | 423 | * table |
| 424 | 424 | */ |
| 425 | 425 | $tableFieldNames = array_map( |
| 426 | - function (Field $field) { |
|
| 426 | + function(Field $field) { |
|
| 427 | 427 | return $field->getName(); |
| 428 | 428 | }, |
| 429 | 429 | $this->tableFields |
| 430 | 430 | ); |
| 431 | 431 | |
| 432 | 432 | $graphqlQuery = $this->fModel->mapFields( |
| 433 | - function (Field $f) use ($tableFieldNames) { |
|
| 433 | + function(Field $f) use ($tableFieldNames) { |
|
| 434 | 434 | if (in_array($f->getName(), $tableFieldNames)) { |
| 435 | 435 | // TODO: filter subfields in relationships |
| 436 | 436 | return $f->toGraphqlQuery(); |
@@ -470,7 +470,7 @@ discard block |
||
| 470 | 470 | * item |
| 471 | 471 | */ |
| 472 | 472 | $graphqlQuery = $this->fModel->mapFields( |
| 473 | - function (Field $f) { |
|
| 473 | + function(Field $f) { |
|
| 474 | 474 | return \Modelarium\Frontend\Util::fieldShow($f) ? $f->toGraphqlQuery() : null; |
| 475 | 475 | } |
| 476 | 476 | ); |