2978727: Use current time setting for the timestamp widget
1 unresolved thread
Updated use_current_time as an 'select' type Fix some phpcs issue Added test
Merge request reports
Activity
added 159 commits
-
9be653f0...e7bb6157 - 158 commits from branch
project:11.x
- 52fbc662 - Merge branch '11.x' into drupal-2978727-2978727-use-current-time
-
9be653f0...e7bb6157 - 158 commits from branch
added 1 commit
- d93bf64e - 2978727: Fix bug in test by enforcing field name on class
added 1 commit
- 44b24b52 - 2798727: Add post-update hook to system module to provide upgrade path to...
69 102 ]); 70 103 71 104 $this->drupalLogin($web_user); 72 $field_name = 'field_timestamp'; 105 $this->fieldName = $field_name = 'field_timestamp'; Suggest to replace the remaining three instances of
$field_name
inTimestampTest::setup()
should become references to$this->fieldName
, then you can eliminate the duplicated variable on line 105. (Provided there's not something complicated happening I missed!)105 $this->fieldName = $field_name = 'field_timestamp'; 106 $type = 'timestamp'; 107 $widget_type = 'datetime_timestamp'; 108 $formatter_type = 'timestamp'; 109 110 $this->fieldStorage = FieldStorageConfig::create([ 111 'field_name' => $field_name, 112 'entity_type' => 'entity_test', 113 'type' => $type, 114 ]); 115 $this->fieldStorage->save(); 116 $this->field = FieldConfig::create([ 117 'field_storage' => $this->fieldStorage, 118 'bundle' => 'entity_test', 119 'required' => TRUE, 120 'description' => 'Description for timestamp field.', 121 ]); 122 $this->field->save(); 123 124 EntityFormDisplay::load('entity_test.entity_test.default') 125 ->setComponent($field_name, ['type' => $widget_type]) 126 ->save(); 127 128 $this->displayOptions = [ 129 'type' => $formatter_type, 130 'label' => 'hidden', 131 ]; 132 133 EntityViewDisplay::create([ 134 'targetEntityType' => $this->field->getTargetEntityTypeId(), 135 'bundle' => $this->field->getTargetBundle(), 136 'mode' => 'full', 137 'status' => TRUE, 138 ])->setComponent($field_name, $this->displayOptions) 139 ->save(); 105 $this->fieldName = 'field_timestamp'; 106 $type = 'timestamp'; 107 $widget_type = 'datetime_timestamp'; 108 $formatter_type = 'timestamp'; 109 110 $this->fieldStorage = FieldStorageConfig::create([ 111 'field_name' => $this->fieldName, 112 'entity_type' => 'entity_test', 113 'type' => $type, 114 ]); 115 $this->fieldStorage->save(); 116 $this->field = FieldConfig::create([ 117 'field_storage' => $this->fieldStorage, 118 'bundle' => 'entity_test', 119 'required' => TRUE, 120 'description' => 'Description for timestamp field.', 121 ]); 122 $this->field->save(); 123 124 EntityFormDisplay::load('entity_test.entity_test.default') 125 ->setComponent($this->fieldName, ['type' => $widget_type]) 126 ->save(); 127 128 $this->displayOptions = [ 129 'type' => $formatter_type, 130 'label' => 'hidden', 131 ]; 132 133 EntityViewDisplay::create([ 134 'targetEntityType' => $this->field->getTargetEntityTypeId(), 135 'bundle' => $this->field->getTargetBundle(), 136 'mode' => 'full', 137 'status' => TRUE, 138 ])->setComponent($this->fieldName, $this->displayOptions) 139 ->save(); Edited by Chris Burgess
Please register or sign in to reply