Issue #2586047 by willzyx: Fatal error: Call to a member function getFieldStorageDefinition()
parent
96808b3a38
commit
718c503a52
|
@ -13,6 +13,7 @@ use Drupal\Core\Form\FormStateInterface;
|
||||||
use Drupal\Core\Routing\RouteMatchInterface;
|
use Drupal\Core\Routing\RouteMatchInterface;
|
||||||
use Drupal\field\Entity\FieldConfig;
|
use Drupal\field\Entity\FieldConfig;
|
||||||
use Drupal\field_ui\FieldUI;
|
use Drupal\field_ui\FieldUI;
|
||||||
|
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides a form for the "field storage" edit page.
|
* Provides a form for the "field storage" edit page.
|
||||||
|
@ -33,6 +34,9 @@ class FieldStorageConfigEditForm extends EntityForm {
|
||||||
// The URL of this entity form contains only the ID of the field_config
|
// The URL of this entity form contains only the ID of the field_config
|
||||||
// but we are actually editing a field_storage_config entity.
|
// but we are actually editing a field_storage_config entity.
|
||||||
$field_config = FieldConfig::load($route_match->getRawParameter('field_config'));
|
$field_config = FieldConfig::load($route_match->getRawParameter('field_config'));
|
||||||
|
if (!$field_config) {
|
||||||
|
throw new NotFoundHttpException();
|
||||||
|
}
|
||||||
|
|
||||||
return $field_config->getFieldStorageDefinition();
|
return $field_config->getFieldStorageDefinition();
|
||||||
}
|
}
|
||||||
|
|
|
@ -718,4 +718,17 @@ class ManageFieldsTest extends WebTestBase {
|
||||||
$this->assertEqual($view_display->getComponent('field_test_custom_options')['type'], 'field_test_multiple');
|
$this->assertEqual($view_display->getComponent('field_test_custom_options')['type'], 'field_test_multiple');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests the access to non-existent field URLs.
|
||||||
|
*/
|
||||||
|
public function testNonExistentFieldUrls() {
|
||||||
|
$field_id = 'node.foo.bar';
|
||||||
|
|
||||||
|
$this->drupalGet('admin/structure/types/manage/' . $this->contentType . '/fields/' . $field_id);
|
||||||
|
$this->assertResponse(404);
|
||||||
|
|
||||||
|
$this->drupalGet('admin/structure/types/manage/' . $this->contentType . '/fields/' . $field_id . '/storage');
|
||||||
|
$this->assertResponse(404);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue