Update to Drupal 8.0.3. For more information, see https://www.drupal.org/drupal-8.0.3-release-notes
This commit is contained in:
parent
10f9f7fbde
commit
9db4fae9a7
202 changed files with 3806 additions and 760 deletions
|
@ -33,7 +33,7 @@ class EntityDeriver implements ContainerDeriverInterface {
|
|||
protected $entityManager;
|
||||
|
||||
/**
|
||||
* Constructs an EntityDerivative object.
|
||||
* Constructs an EntityDeriver object.
|
||||
*
|
||||
* @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager
|
||||
* The entity manager.
|
||||
|
@ -86,7 +86,7 @@ class EntityDeriver implements ContainerDeriverInterface {
|
|||
// Check if there are link templates defined for the entity type and
|
||||
// use the path from the route instead of the default.
|
||||
if ($link_template = $entity_type->getLinkTemplate($link_relation)) {
|
||||
$this->derivatives[$entity_type_id]['uri_paths'][$link_relation] = '/' . $link_template;
|
||||
$this->derivatives[$entity_type_id]['uri_paths'][$link_relation] = $link_template;
|
||||
}
|
||||
else {
|
||||
$this->derivatives[$entity_type_id]['uri_paths'][$link_relation] = $default_uri;
|
||||
|
|
|
@ -29,7 +29,7 @@ use Symfony\Component\HttpKernel\Exception\HttpException;
|
|||
* }
|
||||
* )
|
||||
*
|
||||
* @see \Drupal\rest\Plugin\Derivative\EntityDerivative
|
||||
* @see \Drupal\rest\Plugin\Deriver\EntityDeriver
|
||||
*/
|
||||
class EntityResource extends ResourceBase {
|
||||
|
||||
|
|
|
@ -88,6 +88,10 @@ class DataFieldRow extends RowPluginBase {
|
|||
|
||||
if ($fields = $this->view->display_handler->getOption('fields')) {
|
||||
foreach ($fields as $id => $field) {
|
||||
// Don't show the field if it has been excluded.
|
||||
if (!empty($field['exclude'])) {
|
||||
continue;
|
||||
}
|
||||
$form['field_options'][$id]['field'] = array(
|
||||
'#markup' => $id,
|
||||
);
|
||||
|
@ -138,6 +142,10 @@ class DataFieldRow extends RowPluginBase {
|
|||
$output = array();
|
||||
|
||||
foreach ($this->view->field as $id => $field) {
|
||||
// Don't render anything if this field is excluded.
|
||||
if (!empty($field->options['exclude'])) {
|
||||
continue;
|
||||
}
|
||||
// If the raw output option has been set, just get the raw value.
|
||||
if (!empty($this->rawOutputOptions[$id])) {
|
||||
$value = $field->getValue($row);
|
||||
|
|
|
@ -106,4 +106,19 @@ class ResourceTest extends RESTTestBase {
|
|||
$this->curlClose();
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests that resource URI paths are formatted properly.
|
||||
*/
|
||||
public function testUriPaths() {
|
||||
$this->enableService('entity:entity_test');
|
||||
/** @var \Drupal\rest\Plugin\Type\ResourcePluginManager $manager */
|
||||
$manager = \Drupal::service('plugin.manager.rest');
|
||||
|
||||
foreach ($manager->getDefinitions() as $resource => $definition) {
|
||||
foreach ($definition['uri_paths'] as $key => $uri_path) {
|
||||
$this->assertFalse(strpos($uri_path, '//'), 'The resource URI path does not have duplicate slashes.');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -470,6 +470,32 @@ class StyleSerializerTest extends PluginTestBase {
|
|||
$this->assertIdentical($values['created'], $view->result[$index]->views_test_data_created, 'Expected raw created value found.');
|
||||
$this->assertIdentical($values['name'], $view->result[$index]->views_test_data_name, 'Expected raw name value found.');
|
||||
}
|
||||
|
||||
// Test result with an excluded field.
|
||||
$view->setDisplay('rest_export_1');
|
||||
$view->displayHandlers->get('rest_export_1')->overrideOption('fields', [
|
||||
'name' => [
|
||||
'id' => 'name',
|
||||
'table' => 'views_test_data',
|
||||
'field' => 'name',
|
||||
'relationship' => 'none',
|
||||
],
|
||||
'created' => [
|
||||
'id' => 'created',
|
||||
'exclude' => TRUE,
|
||||
'table' => 'views_test_data',
|
||||
'field' => 'created',
|
||||
'relationship' => 'none',
|
||||
],
|
||||
]);
|
||||
$view->save();
|
||||
$this->executeView($view);
|
||||
foreach ($this->drupalGetJSON('test/serialize/field') as $index => $values) {
|
||||
$this->assertTrue(!isset($values['created']), 'Excluded value not found.');
|
||||
}
|
||||
// Test that the excluded field is not shown in the row options.
|
||||
$this->drupalGet('admin/structure/views/nojs/display/test_serializer_display_field/rest_export_1/row_options');
|
||||
$this->assertNoText('created');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Reference in a new issue