Skip to content

Commit ae491ce

Browse files
authored
Merge pull request #194 from lehors/hide-more-fields
Hide more fields
2 parents 190b008 + fd5fcd1 commit ae491ce

6 files changed

Lines changed: 21 additions & 19 deletions

File tree

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"require": {
1818
"composer/installers": "^2.0",
1919
"cweagans/composer-patches": "^1.7",
20-
"drupal/block_exclude_pages": "^2.1",
20+
"drupal/block_exclude_pages": "^2.2",
2121
"drupal/captcha": "^2.0",
2222
"drupal/cheeseburger_menu": "^5.0@RC",
2323
"drupal/core-composer-scaffold": "^10.5",

composer.lock

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

schema/mof_schema.json

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -162,13 +162,8 @@
162162
},
163163
"required": [
164164
"name",
165-
"version",
166165
"license",
167-
"date",
168-
"architecture",
169-
"origin",
170166
"producer",
171-
"contact",
172167
"components"
173168
]
174169
}

web/modules/mof/src/Entity/Model.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,7 @@ public static function baseFieldDefinitions(EntityTypeInterface $entity_type): a
382382
'type' => 'text_default',
383383
'label' => 'above',
384384
'weight' => -90,
385+
'region' => 'hidden',
385386
])
386387
->setDisplayConfigurable('view', TRUE)
387388
->setRequired(FALSE);
@@ -400,6 +401,7 @@ public static function baseFieldDefinitions(EntityTypeInterface $entity_type): a
400401
'type' => 'text_default',
401402
'label' => 'inline',
402403
'weight' => -80,
404+
'region' => 'hidden',
403405
])
404406
->setDisplayConfigurable('view', TRUE)
405407
->setRequired(FALSE);
@@ -430,6 +432,7 @@ public static function baseFieldDefinitions(EntityTypeInterface $entity_type): a
430432
'label' => 'inline',
431433
'type' => 'string',
432434
'weight' => -60,
435+
'region' => 'hidden',
433436
])
434437
->setDisplayConfigurable('view', TRUE);
435438

@@ -463,6 +466,7 @@ public static function baseFieldDefinitions(EntityTypeInterface $entity_type): a
463466
'label' => 'inline',
464467
'type' => 'string',
465468
'weight' => -50,
469+
'region' => 'hidden',
466470
])
467471
->setDisplayConfigurable('view', TRUE);
468472

@@ -486,6 +490,7 @@ public static function baseFieldDefinitions(EntityTypeInterface $entity_type): a
486490
'label' => 'inline',
487491
'type' => 'string',
488492
'weight' => -40,
493+
'region' => 'hidden',
489494
])
490495
->setDisplayConfigurable('view', TRUE);
491496

@@ -505,6 +510,7 @@ public static function baseFieldDefinitions(EntityTypeInterface $entity_type): a
505510
'label' => 'inline',
506511
'type' => 'string',
507512
'weight' => -30,
513+
'region' => 'hidden',
508514
])
509515
->setDisplayConfigurable('view', TRUE);
510516

web/modules/mof/src/Form/ModelForm.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,12 @@ public function form(array $form, FormStateInterface $form_state): array {
121121
// The description field is not currently saved in the YAML model file so we may as well hide it away
122122
// until we decide whether to just get rid of it altogether or add it to the YAML file.
123123
$form['details']['description']['#access'] = FALSE;
124+
// Hide more fields to keep input to the what's really useful and make the form simpler
125+
$form['details']['version']['#access'] = FALSE;
126+
$form['details']['type']['#access'] = FALSE;
127+
$form['details']['architecture']['#access'] = FALSE;
128+
$form['details']['treatment']['#access'] = FALSE;
129+
$form['details']['origin']['#access'] = FALSE;
124130

125131
// Model licenses to populate fields with a default value.
126132
$model_licenses = $this->entity->getLicenses() ?? [];

web/modules/mof/src/ModelSerializer.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,8 @@ public function normalize(ModelInterface $model): array {
3838
],
3939
'release' => [
4040
'name' => $model->label(),
41-
'version' => $model->getVersion() ?? '',
4241
'date' => date('Y-m-d', $model->getChangedTime()),
43-
'type' => $model->getType() ?? '',
44-
'architecture' => $model->getArchitecture() ?? '',
45-
'origin' => $model->getOrigin() ?? '',
4642
'producer' => $model->getOrganization() ?? '',
47-
'contact' => $owner->id() > 1 ? $owner->getEmail() : '',
4843
'repository' => $model->getRepository() ?? '',
4944
'huggingface' => $model->getHuggingface() ?? '',
5045
],

0 commit comments

Comments
 (0)