|
|
@@ -0,0 +1,40 @@
|
|
|
+<?php
|
|
|
+// Seadista emal_liige view display (default) D7 analoogselt:
|
|
|
+// inline label-iga väljad õiges järjekorras.
|
|
|
+use Drupal\Core\Entity\Entity\EntityViewDisplay;
|
|
|
+
|
|
|
+$display = EntityViewDisplay::load('node.emal_liige.default');
|
|
|
+if (!$display) {
|
|
|
+ echo "view display puudub\n";
|
|
|
+ return;
|
|
|
+}
|
|
|
+
|
|
|
+// D7 display järjekord (weight): nimi(0), e-mail(1), liige alates(2),
|
|
|
+// isikukood(3), vanus/sünnipäev(4), liikme tüüp(6), kasutamisõigus(7), muu(8, hidden).
|
|
|
+$fields = [
|
|
|
+ 'field_nimi' => ['type' => 'string', 'label' => 'inline', 'weight' => 0],
|
|
|
+ 'field_e_mail' => ['type' => 'email_mailto', 'label' => 'inline', 'weight' => 1],
|
|
|
+ 'field_liikmeks_astumise_aasta' => ['type' => 'daterange_default', 'label' => 'inline', 'weight' => 2],
|
|
|
+ 'field_isikukood' => ['type' => 'string', 'label' => 'inline', 'weight' => 3],
|
|
|
+ 'field_sunnipaev' => ['type' => 'datetime_default', 'label' => 'inline', 'weight' => 4],
|
|
|
+ 'field_emal_liikme_tyyp' => ['type' => 'entity_reference_label', 'label' => 'inline', 'weight' => 6],
|
|
|
+ 'field_emal_kasutaja_oigused' => ['type' => 'string', 'label' => 'inline', 'weight' => 7],
|
|
|
+];
|
|
|
+
|
|
|
+foreach ($fields as $name => $conf) {
|
|
|
+ $display->setComponent($name, [
|
|
|
+ 'type' => $conf['type'],
|
|
|
+ 'label' => $conf['label'],
|
|
|
+ 'weight' => $conf['weight'],
|
|
|
+ 'settings' => [],
|
|
|
+ 'third_party_settings' => [],
|
|
|
+ ]);
|
|
|
+ echo "kuvatud: $name ({$conf['type']}, inline)\n";
|
|
|
+}
|
|
|
+
|
|
|
+// field_muu_01 jääb peidetuks (D7-s oli type hidden).
|
|
|
+$display->removeComponent('field_muu_01');
|
|
|
+echo "peidetud: field_muu_01\n";
|
|
|
+
|
|
|
+$display->save();
|
|
|
+echo "done\n";
|