diff --git a/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php b/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php index a5000ce..330f39c 100644 --- a/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php +++ b/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php @@ -110,20 +110,4 @@ public static function sort($a, $b) { } return ($a_weight < $b_weight) ? -1 : 1; } - - /** - * Overrides \Drupal\Core\Entity\Entity::getExportProperties(). - */ - public function getExportProperties() { - // Configuration objects do not have a schema. Extract all key names from - // class properties. - $class_info = new \ReflectionClass($this); - $properties = array(); - foreach ($class_info->getProperties(\ReflectionProperty::IS_PUBLIC) as $property) { - $name = $property->getName(); - $properties[$name] = $this->get($name); - } - return $properties; - } - } diff --git a/core/lib/Drupal/Core/Config/Entity/ConfigStorageController.php b/core/lib/Drupal/Core/Config/Entity/ConfigStorageController.php index fbd6611..6d0a3f4 100644 --- a/core/lib/Drupal/Core/Config/Entity/ConfigStorageController.php +++ b/core/lib/Drupal/Core/Config/Entity/ConfigStorageController.php @@ -299,7 +299,7 @@ public function save(EntityInterface $entity) { $this->invokeHook('presave', $entity); // Retrieve the desired properties and set them in config. - foreach ($entity->getExportProperties() as $key => $value) { + foreach ($this->getProperties($entity) as $key => $value) { $config->set($key, $value); } @@ -336,6 +336,29 @@ public function save(EntityInterface $entity) { } /** + * Retrieves the exportable properties of an entity. + * + * @param \Drupal\Core\Entity\EntityInterface $entity + * The entity being saved. + * + * @return array + * An array of exportable properties and their values. + * + * @see \Drupal\Core\Config\Entity\ConfigStorageController::save() + */ + protected function getProperties(EntityInterface $entity) { + // Configuration objects do not have a schema. Extract all key names from + // class properties. + $class_info = new \ReflectionClass($entity); + $properties = array(); + foreach ($class_info->getProperties(\ReflectionProperty::IS_PUBLIC) as $property) { + $name = $property->getName(); + $properties[$name] = $entity->$name; + } + return $properties; + } + + /** * Acts on an entity before the presave hook is invoked. * * Used before the entity is saved and before invoking the presave hook. diff --git a/core/lib/Drupal/Core/Entity/Entity.php b/core/lib/Drupal/Core/Entity/Entity.php index 1b511e1..979614f 100644 --- a/core/lib/Drupal/Core/Entity/Entity.php +++ b/core/lib/Drupal/Core/Entity/Entity.php @@ -371,12 +371,4 @@ public function isDefaultRevision($new_value = NULL) { } return $return; } - - /** - * Implements Drupal\Core\Entity\EntityInterface::getExportProperties(). - */ - public function getExportProperties() { - return array(); - } - } diff --git a/core/lib/Drupal/Core/Entity/EntityInterface.php b/core/lib/Drupal/Core/Entity/EntityInterface.php index a3e4a62..9b751d4 100644 --- a/core/lib/Drupal/Core/Entity/EntityInterface.php +++ b/core/lib/Drupal/Core/Entity/EntityInterface.php @@ -181,13 +181,4 @@ public function getRevisionId(); * $new_value was passed, the previous value is returned. */ public function isDefaultRevision($new_value = NULL); - - /** - * Retrieves the exportable properties of the entity. - * - * @return array - * An array of exportable properties and their values. - */ - public function getExportProperties(); - } diff --git a/core/modules/comment/comment.module b/core/modules/comment/comment.module index f89d149..ab757a9 100644 --- a/core/modules/comment/comment.module +++ b/core/modules/comment/comment.module @@ -1650,16 +1650,8 @@ function template_preprocess_comment(&$variables) { $variables['comment'] = $comment; $variables['node'] = $node; $variables['author'] = theme('username', array('account' => $comment)); - $variables['created'] = format_date($comment->created); - - // Avoid calling format_date() twice on the same timestamp. - if ($comment->changed == $comment->created) { - $variables['changed'] = $variables['created']; - } - else { - $variables['changed'] = format_date($comment->changed); - } + $variables['changed'] = format_date($comment->changed); $variables['new'] = !empty($comment->new) ? t('new') : ''; if (theme_get_setting('toggle_comment_user_picture')) { @@ -1685,13 +1677,7 @@ function template_preprocess_comment(&$variables) { $variables['parent_comment'] = $comment_parent; $variables['parent_author'] = theme('username', array('account' => $comment_parent)); $variables['parent_created'] = format_date($comment_parent->created); - // Avoid calling format_date() twice on the same timestamp. - if ($comment_parent->changed == $comment_parent->created) { - $variables['parent_changed'] = $variables['parent_created']; - } - else { - $variables['parent_changed'] = format_date($comment_parent->changed); - } + $variables['parent_changed'] = format_date($comment_parent->changed); $uri_parent = $comment_parent->uri(); $uri_parent['options'] += array('attributes' => array('class' => 'permalink', 'rel' => 'bookmark')); $variables['parent_title'] = l($comment_parent->subject, $uri_parent['path'], $uri_parent['options']); diff --git a/core/modules/comment/tests/modules/comment_test_views/comment_test_views.info b/core/modules/comment/tests/modules/comment_test_views/comment_test_views.info deleted file mode 100644 index b1e08b3..0000000 --- a/core/modules/comment/tests/modules/comment_test_views/comment_test_views.info +++ /dev/null @@ -1,8 +0,0 @@ -name = Comment test views -description = Provides default views for views comment tests. -package = Testing -version = VERSION -core = 8.x -dependencies[] = comment -dependencies[] = views -hidden = TRUE diff --git a/core/modules/comment/tests/modules/comment_test_views/comment_test_views.module b/core/modules/comment/tests/modules/comment_test_views/comment_test_views.module deleted file mode 100644 index b3d9bbc..0000000 --- a/core/modules/comment/tests/modules/comment_test_views/comment_test_views.module +++ /dev/null @@ -1 +0,0 @@ -derivatives[$entity_type] = array( 'id' => 'entity:' . $entity_type, 'entity_type' => $entity_type, - 'serialization_class' => $entity_info['class'], 'label' => $entity_info['label'], ); $this->derivatives[$entity_type] += $base_plugin_definition; diff --git a/core/modules/rest/lib/Drupal/rest/Plugin/ResourceBase.php b/core/modules/rest/lib/Drupal/rest/Plugin/ResourceBase.php index fa53bbb..829013f 100644 --- a/core/modules/rest/lib/Drupal/rest/Plugin/ResourceBase.php +++ b/core/modules/rest/lib/Drupal/rest/Plugin/ResourceBase.php @@ -53,36 +53,24 @@ public function permissions() { */ public function routes() { $collection = new RouteCollection(); - $name = strtr($this->plugin_id, ':', '.'); - $prefix = strtr($this->plugin_id, ':', '/'); + $methods = $this->requestMethods(); foreach ($methods as $method) { $lower_method = strtolower($method); // Only expose routes where the HTTP request method exists on the plugin. if (method_exists($this, $lower_method)) { - // Special case for resource creation via POST: Add a route that does - // not require an ID. - if ($method == 'POST') { - $route = new Route("/$prefix", array( - '_controller' => 'Drupal\rest\RequestHandler::handle', - '_plugin' => $this->plugin_id, - 'id' => NULL, - ), array( - // The HTTP method is a requirement for this route. - '_method' => $method, - '_permission' => "restful $lower_method $this->plugin_id", - )); - } - else { - $route = new Route("/$prefix/{id}", array( - '_controller' => 'Drupal\rest\RequestHandler::handle', - '_plugin' => $this->plugin_id, - ), array( - // The HTTP method is a requirement for this route. - '_method' => $method, - '_permission' => "restful $lower_method $this->plugin_id", - )); - } + $prefix = strtr($this->plugin_id, ':', '/'); + $route = new Route("/$prefix/{id}", array( + '_controller' => 'Drupal\rest\RequestHandler::handle', + // Pass the resource plugin ID along as default property. + '_plugin' => $this->plugin_id, + ), array( + // The HTTP method is a requirement for this route. + '_method' => $method, + '_permission' => "restful $lower_method $this->plugin_id", + )); + + $name = strtr($this->plugin_id, ':', '.'); $collection->add("$name.$method", $route); } } diff --git a/core/modules/rest/lib/Drupal/rest/Plugin/rest/resource/DBLogResource.php b/core/modules/rest/lib/Drupal/rest/Plugin/rest/resource/DBLogResource.php index 13af57b..5a1fe31 100644 --- a/core/modules/rest/lib/Drupal/rest/Plugin/rest/resource/DBLogResource.php +++ b/core/modules/rest/lib/Drupal/rest/Plugin/rest/resource/DBLogResource.php @@ -47,14 +47,14 @@ public function routes() { */ public function get($id = NULL) { if ($id) { - $record = db_query("SELECT * FROM {watchdog} WHERE wid = :wid", array(':wid' => $id)) + $result = db_query("SELECT * FROM {watchdog} WHERE wid = :wid", array(':wid' => $id)) ->fetchObject(); - if (!empty($record)) { + if (!empty($result)) { // Serialization is done here, so we indicate with NULL that there is no // subsequent serialization necessary. $response = new ResourceResponse(NULL, 200, array('Content-Type' => 'application/json')); // @todo remove hard coded format here. - $response->setContent(drupal_json_encode($record)); + $response->setContent(drupal_json_encode($result)); return $response; } } diff --git a/core/modules/rest/lib/Drupal/rest/Plugin/rest/resource/EntityResource.php b/core/modules/rest/lib/Drupal/rest/Plugin/rest/resource/EntityResource.php index 2b246b7..689fd84 100644 --- a/core/modules/rest/lib/Drupal/rest/Plugin/rest/resource/EntityResource.php +++ b/core/modules/rest/lib/Drupal/rest/Plugin/rest/resource/EntityResource.php @@ -9,11 +9,9 @@ use Drupal\Core\Annotation\Plugin; use Drupal\Core\Annotation\Translation; -use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityStorageException; use Drupal\rest\Plugin\ResourceBase; use Drupal\rest\ResourceResponse; -use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; use Symfony\Component\HttpKernel\Exception\HttpException; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; @@ -23,7 +21,6 @@ * @Plugin( * id = "entity", * label = @Translation("Entity"), - * serialization_class = "Drupal\Core\Entity\Entity", * derivative = "Drupal\rest\Plugin\Derivative\EntityDerivative" * ) */ @@ -50,42 +47,6 @@ public function get($id) { } /** - * Responds to entity POST requests and saves the new entity. - * - * @param mixed $id - * Ignored. A new entity is created with a new ID. - * @param \Drupal\Core\Entity\EntityInterface $entity - * The entity. - * - * @return \Drupal\rest\ResourceResponse - * The HTTP response object. - * - * @throws \Symfony\Component\HttpKernel\Exception\HttpException - */ - public function post($id, EntityInterface $entity) { - // Verify that the deserialized entity is of the type that we expect to - // prevent security issues. - $definition = $this->getDefinition(); - if ($entity->entityType() != $definition['entity_type']) { - throw new BadRequestHttpException(); - } - // POSTed entities must not have an ID set, because we always want to create - // new entities here. - if (!$entity->isNew()) { - throw new BadRequestHttpException(); - } - try { - $entity->save(); - $url = url(strtr($this->plugin_id, ':', '/') . '/' . $entity->id(), array('absolute' => TRUE)); - // 201 Created responses have an empty body. - return new ResourceResponse(NULL, 201, array('Location' => $url)); - } - catch (EntityStorageException $e) { - throw new HttpException(500, 'Internal Server Error', $e); - } - } - - /** * Responds to entity DELETE requests. * * @param mixed $id diff --git a/core/modules/rest/lib/Drupal/rest/RequestHandler.php b/core/modules/rest/lib/Drupal/rest/RequestHandler.php index b8d6d42..53011cf 100644 --- a/core/modules/rest/lib/Drupal/rest/RequestHandler.php +++ b/core/modules/rest/lib/Drupal/rest/RequestHandler.php @@ -34,30 +34,19 @@ public function handle(Request $request, $id = NULL) { $resource = $this->container ->get('plugin.manager.rest') ->getInstance(array('id' => $plugin)); - - // Deserialze incoming data if available. - $serializer = $this->container->get('serializer'); $received = $request->getContent(); - $unserialized = NULL; - if (!empty($received)) { - $definition = $resource->getDefinition(); - $class = $definition['serialization_class']; - // @todo Replace the format here with something we get from the HTTP - // Content-type header. See http://drupal.org/node/1850704 - $unserialized = $serializer->deserialize($received, $class, 'drupal_jsonld'); - } - - // Invoke the operation on the resource plugin. + // @todo De-serialization should happen here if the request is supposed + // to carry incoming data. try { - $response = $resource->{$method}($id, $unserialized, $request); + $response = $resource->{$method}($id, $received); } catch (HttpException $e) { return new Response($e->getMessage(), $e->getStatusCode(), $e->getHeaders()); } - - // Serialize the outgoing data for the response, if available. $data = $response->getResponseData(); if ($data != NULL) { + // Serialize the response data. + $serializer = $this->container->get('serializer'); // @todo Replace the format here with something we get from the HTTP // Accept headers. See http://drupal.org/node/1833440 $output = $serializer->serialize($data, 'drupal_jsonld'); diff --git a/core/modules/rest/lib/Drupal/rest/ResourceResponse.php b/core/modules/rest/lib/Drupal/rest/ResourceResponse.php index d79653a..a93f25e 100644 --- a/core/modules/rest/lib/Drupal/rest/ResourceResponse.php +++ b/core/modules/rest/lib/Drupal/rest/ResourceResponse.php @@ -11,11 +11,6 @@ /** * Contains data for serialization before sending the response. - * - * We do not want to abuse the $content property on the Response class to store - * our response data. $content implies that the provided data must either be a - * string or an object with a __toString() method, which is not a requirement - * for data used here. */ class ResourceResponse extends Response { diff --git a/core/modules/rest/lib/Drupal/rest/Tests/CreateTest.php b/core/modules/rest/lib/Drupal/rest/Tests/CreateTest.php deleted file mode 100644 index f5ef159..0000000 --- a/core/modules/rest/lib/Drupal/rest/Tests/CreateTest.php +++ /dev/null @@ -1,85 +0,0 @@ - 'Create resource', - 'description' => 'Tests the creation of resources.', - 'group' => 'REST', - ); - } - - /** - * Tests several valid and invalid create requests on all entity types. - */ - public function testCreate() { - $serializer = drupal_container()->get('serializer'); - // @todo once EntityNG is implemented for other entity types test all other - // entity types here as well. - $entity_type = 'entity_test'; - - $this->enableService('entity:' . $entity_type); - // Create a user account that has the required permissions to create - // resources via the web API. - $account = $this->drupalCreateUser(array('restful post entity:' . $entity_type)); - $this->drupalLogin($account); - - $entity_values = $this->entityValues($entity_type); - $entity = entity_create($entity_type, $entity_values); - $serialized = $serializer->serialize($entity, 'drupal_jsonld'); - // Create the entity over the web API. - $response = $this->httpRequest('entity/' . $entity_type, 'POST', $serialized, 'application/vnd.drupal.ld+json'); - $this->assertResponse('201', 'HTTP response code is correct.'); - - // Get the new entity ID from the location header and try to read it from - // the database. - $location_url = $this->responseHeaders['location']; - $url_parts = explode('/', $location_url); - $id = end($url_parts); - $loaded_entity = entity_load($entity_type, $id); - $this->assertNotIdentical(FALSE, $loaded_entity, 'The new ' . $entity_type . ' was found in the database.'); - $this->assertEqual($entity->uuid(), $loaded_entity->uuid(), 'UUID of created entity is correct.'); - // @todo Remove the user reference field for now until deserialization for - // entity references is implemented. - unset($entity_values['user_id']); - foreach ($entity_values as $property => $value) { - $actual_value = $loaded_entity->get($property); - $this->assertEqual($value, $actual_value->value, 'Created property ' . $property . ' expected: ' . $value . ', actual: ' . $actual_value->value); - } - - // Try to create an entity without proper permissions. - $this->drupalLogout(); - $response = $this->httpRequest('entity/' . $entity_type, 'POST', $serialized, 'application/vnd.drupal.ld+json'); - $this->assertResponse(403); - - // Try to create a resource which is not web API enabled. - $this->enableService(FALSE); - $this->drupalLogin($account); - $this->httpRequest('entity/entity_test', 'POST', $serialized, 'application/vnd.drupal.ld+json'); - $this->assertResponse(404); - - // @todo Once EntityNG is implemented for other entity types add a security - // test. It should not be possible for example to create a test entity on a - // node resource route. - } -} diff --git a/core/modules/rest/lib/Drupal/rest/Tests/DBLogTest.php b/core/modules/rest/lib/Drupal/rest/Tests/DBLogTest.php index 9ea37c1..5002397 100644 --- a/core/modules/rest/lib/Drupal/rest/Tests/DBLogTest.php +++ b/core/modules/rest/lib/Drupal/rest/Tests/DBLogTest.php @@ -52,7 +52,7 @@ public function testWatchdog() { $response = $this->httpRequest("dblog/$id", 'GET', NULL, 'application/json'); $this->assertResponse(200); - $this->assertHeader('content-type', 'application/json'); + $this->assertHeader('Content-Type', 'application/json'); $log = drupal_json_decode($response); $this->assertEqual($log['wid'], $id, 'Log ID is correct.'); $this->assertEqual($log['type'], 'rest_test', 'Type of log message is correct.'); diff --git a/core/modules/rest/lib/Drupal/rest/Tests/RESTTestBase.php b/core/modules/rest/lib/Drupal/rest/Tests/RESTTestBase.php index 3640e48..acf4802 100644 --- a/core/modules/rest/lib/Drupal/rest/Tests/RESTTestBase.php +++ b/core/modules/rest/lib/Drupal/rest/Tests/RESTTestBase.php @@ -85,9 +85,7 @@ protected function httpRequest($url, $method, $body = NULL, $format = 'applicati $header_lines = explode("\r\n", $header); foreach ($header_lines as $line) { $parts = explode(':', $line, 2); - // Store the header keys lower cased to be more robust. Headers are case - // insensitive according to RFC 2616. - $this->responseHeaders[strtolower($parts[0])] = isset($parts[1]) ? trim($parts[1]) : ''; + $this->responseHeaders[$parts[0]] = isset($parts[1]) ? trim($parts[1]) : ''; } $this->verbose($method . ' request to: ' . $url . @@ -101,38 +99,25 @@ protected function httpRequest($url, $method, $body = NULL, $format = 'applicati /** * Creates entity objects based on their types. * - * @param string $entity_type - * The type of the entity that should be created. - * - * @return \Drupal\Core\Entity\EntityInterface - * The new entity object. - */ - protected function entityCreate($entity_type) { - return entity_create($entity_type, $this->entityValues($entity_type)); - } - - /** - * Provides an array of suitable property values for an entity type. - * * Required properties differ from entity type to entity type, so we keep a * minimum mapping here. * * @param string $entity_type - * The type of the entity that should be created. + * The type of the entity that should be created.. * - * @return array - * An array of values keyed by property name. + * @return \Drupal\Core\Entity\EntityInterface + * The new entity object. */ - protected function entityValues($entity_type) { + protected function entityCreate($entity_type) { switch ($entity_type) { case 'entity_test': - return array('name' => $this->randomName(), 'user_id' => 1); + return entity_create('entity_test', array('name' => $this->randomName(), 'user_id' => 1)); case 'node': - return array('title' => $this->randomString()); + return entity_create('node', array('title' => $this->randomString())); case 'user': - return array('name' => $this->randomName()); + return entity_create('user', array('name' => $this->randomName())); default: - return array(); + return entity_create($entity_type, array()); } } diff --git a/core/modules/rest/lib/Drupal/rest/Tests/ReadTest.php b/core/modules/rest/lib/Drupal/rest/Tests/ReadTest.php index 7ebe5f2..0c710e5 100644 --- a/core/modules/rest/lib/Drupal/rest/Tests/ReadTest.php +++ b/core/modules/rest/lib/Drupal/rest/Tests/ReadTest.php @@ -53,7 +53,7 @@ public function testRead() { // Read it over the web API. $response = $this->httpRequest('entity/' . $entity_type . '/' . $entity->id(), 'GET', NULL, 'application/vnd.drupal.ld+json'); $this->assertResponse('200', 'HTTP response code is correct.'); - $this->assertHeader('content-type', 'application/vnd.drupal.ld+json'); + $this->assertHeader('Content-Type', 'application/vnd.drupal.ld+json'); $data = drupal_json_decode($response); // Only assert one example property here, other properties should be // checked in serialization tests. diff --git a/core/modules/system/system.theme.css b/core/modules/system/system.theme.css index e5ddb28..0bbeaf6 100644 --- a/core/modules/system/system.theme.css +++ b/core/modules/system/system.theme.css @@ -123,7 +123,7 @@ input.form-radio { } .marker, .form-required { - color: #e00; + color: #f00; } abbr.form-required, abbr.tabledrag-changed, abbr.ajax-changed { border-bottom: none; diff --git a/core/modules/taxonomy/tests/modules/taxonomy_test_views/taxonomy_test_views.info b/core/modules/taxonomy/tests/modules/taxonomy_test_views/taxonomy_test_views.info deleted file mode 100644 index bed1a77..0000000 --- a/core/modules/taxonomy/tests/modules/taxonomy_test_views/taxonomy_test_views.info +++ /dev/null @@ -1,8 +0,0 @@ -name = Taxonomy test views -description = Provides default views for views taxonomy tests. -package = Testing -version = VERSION -core = 8.x -dependencies[] = taxonomy -dependencies[] = views -hidden = TRUE diff --git a/core/modules/taxonomy/tests/modules/taxonomy_test_views/taxonomy_test_views.module b/core/modules/taxonomy/tests/modules/taxonomy_test_views/taxonomy_test_views.module deleted file mode 100644 index b3d9bbc..0000000 --- a/core/modules/taxonomy/tests/modules/taxonomy_test_views/taxonomy_test_views.module +++ /dev/null @@ -1 +0,0 @@ - FALSE, + 'weight' => 10, + ); + field_bundle_settings('user', 'user', $bundle_settings); } /** diff --git a/core/modules/user/lib/Drupal/user/UserAccessController.php b/core/modules/user/lib/Drupal/user/UserAccessController.php new file mode 100644 index 0000000..e9f16a7 --- /dev/null +++ b/core/modules/user/lib/Drupal/user/UserAccessController.php @@ -0,0 +1,74 @@ +uid; + if (!$account) { + $account = $GLOBALS['user']; + } + + // Never allow access to view the anonymous user account. + if ($uid) { + // Admins can view all, users can view own profiles at all times. + if ($account->uid == $uid || user_access('administer users')) { + return TRUE; + } + elseif (user_access('access user profiles')) { + // Only allow view access if the account is active. + return $entity->status; + } + } + return FALSE; + } + + /** + * Implements EntityAccessControllerInterface::createAccess(). + */ + public function createAccess(EntityInterface $entity, $langcode = LANGUAGE_DEFAULT, User $account = NULL) { + return user_access('administer users', $account); + } + + /** + * Implements EntityAccessControllerInterface::updateAccess(). + */ + public function updateAccess(EntityInterface $entity, $langcode = LANGUAGE_DEFAULT, User $account = NULL) { + if (!$account) { + $account = $GLOBALS['user']; + } + // Users can always edit their own account. Users with the 'administer + // users' permission can edit any account except the anonymous account. + return (($account->uid == $entity->uid) || user_access('administer users')) && $entity->uid > 0; + } + + /** + * Implements EntityAccessControllerInterface::deleteAccess(). + */ + public function deleteAccess(EntityInterface $entity, $langcode = LANGUAGE_DEFAULT, User $account = NULL) { + if (!$account) { + $account = $GLOBALS['user']; + } + // Users with 'cancel account' permission can cancel their own account, + // users with 'administer users' permission can cancel any account except + // the anonymous account. + return ((($account->uid == $entity->uid) && user_access('cancel account')) || user_access('administer users')) && $account->uid > 0; + } + +} diff --git a/core/modules/user/tests/user_test_views/user_test_views.info b/core/modules/user/tests/user_test_views/user_test_views.info deleted file mode 100644 index 52edbbb..0000000 --- a/core/modules/user/tests/user_test_views/user_test_views.info +++ /dev/null @@ -1,8 +0,0 @@ -name = User test views -description = Provides default views for views user tests. -package = Testing -version = VERSION -core = 8.x -dependencies[] = user -dependencies[] = views -hidden = TRUE diff --git a/core/modules/user/tests/user_test_views/user_test_views.module b/core/modules/user/tests/user_test_views/user_test_views.module deleted file mode 100644 index b3d9bbc..0000000 --- a/core/modules/user/tests/user_test_views/user_test_views.module +++ /dev/null @@ -1 +0,0 @@ - 'user_picture', - 'module' => 'image', - 'type' => 'image', - 'cardinality' => 1, - 'locked' => FALSE, - 'indexes' => array('fid' => array('fid')), - 'settings' => array( - 'uri_scheme' => 'public', - 'default_image' => FALSE, - ), - 'storage' => array( - 'type' => 'field_sql_storage', - 'settings' => array(), - ), - ); - $field = field_create_field($field); - - $instance = array( - 'field_name' => 'user_picture', - 'entity_type' => 'user', - 'label' => 'Picture', - 'bundle' => 'user', - 'description' => $t('Your virtual face or picture.'), - 'required' => FALSE, - 'settings' => array( - 'file_extensions' => 'png gif jpg jpeg', - 'file_directory' => 'pictures', - 'max_filesize' => '30 KB', - 'alt_field' => 0, - 'title_field' => 0, - 'max_resolution' => '85x85', - 'min_resolution' => '', - 'default_image' => 0, - ), - 'widget' => array( - 'module' => 'image', - 'type' => 'image_image', - 'settings' => array( - 'progress_indicator' => 'throbber', - 'preview_image_style' => 'thumbnail', - ), - 'weight' => -1, - ), - 'display' => array( - 'default' => array( - 'label' => 'hidden', - 'type' => 'image', - 'settings' => array( - 'image_style' => 'thumbnail', - 'image_link' => 'content', - ), - ), - 'compact' => array( - 'label' => 'hidden', - 'type' => 'image', - 'settings' => array( - 'image_style' => 'thumbnail', - 'image_link' => 'content', - ), - ), - ), - ); - field_create_instance($instance); - - // Remove 'summary' pseudo-field from compact view mode on the User entity. - $bundle_settings = field_bundle_settings('user', 'user'); - $bundle_settings['extra_fields']['display']['member_for']['compact'] = array( - 'visible' => FALSE, - 'weight' => 10, - ); - field_bundle_settings('user', 'user', $bundle_settings); -} - -/** * @addtogroup updates-7.x-to-8.x * @{ */ @@ -784,80 +701,25 @@ function user_update_8011() { ->execute(); $default_image_fid = db_query('SELECT fid FROM {file_managed} WHERE uri = :uri', array(':uri' => $destination))->fetchField(); } - - // Create the field and instance. - $field = array( - 'field_name' => 'user_picture', - 'module' => 'image', - 'type' => 'image', - 'cardinality' => 1, - 'locked' => FALSE, - 'indexes' => array('fid' => array('fid')), - 'settings' => array( - 'uri_scheme' => 'public', - 'default_image' => FALSE, - ), - 'storage' => array( - 'type' => 'field_sql_storage', - 'settings' => array(), - ), - ); - _update_7000_field_create_field($field); - - // In D7, user pictures did not require Image module to work. Image module - // only allowed usage of an image style to format user pictures in the - // output. The 'user_pictures' variable had a global effect on the presence - // of the user picture functionality before. The new user picture image field - // is created regardless of that global setting, which means the field - // appears on the user account form after migration, even if user pictures - // were disabled previously. The picture is only hidden in the output. - $formatter = update_variable_get('user_pictures', 0) ? 'image' : 'hidden'; - $instance = array( - 'field_name' => 'user_picture', - 'entity_type' => 'user', - 'label' => 'Picture', - 'bundle' => 'user', + $settings = array( + // In D7, user pictures did not require Image module to work. Image module + // only allowed usage of an image style to format user pictures in the + // output. The 'user_pictures' variable had a global effect on the + // presence of the user picture functionality before. The new user picture + // image field is created regardless of that global setting, which means + // the field appears on the user account form after migration, even if + // user pictures were disabled previously. The picture is only hidden in + // the output. + 'formatter' => update_variable_get('user_pictures', 0) ? 'image' : 'hidden', + 'file_directory' => update_variable_get('user_picture_path', 'pictures'), + 'default_image' => !empty($default_image_fid) ? $default_image_fid : 0, + 'image_style' => update_variable_get('user_picture_style', ''), + 'max_resolution' => update_variable_get('user_picture_dimensions', '85x85'), + 'max_filesize' => update_variable_get('user_picture_file_size', '30') . ' KB', 'description' => update_variable_get('user_picture_guidelines', ''), - 'required' => FALSE, - 'settings' => array( - 'file_extensions' => 'png gif jpg jpeg', - 'file_directory' => update_variable_get('user_picture_path', 'pictures'), - 'max_filesize' => update_variable_get('user_picture_file_size', '30') . ' KB', - 'alt_field' => 0, - 'title_field' => 0, - 'max_resolution' => update_variable_get('user_picture_dimensions', '85x85'), - 'min_resolution' => '', - 'default_image' => !empty($default_image_fid) ? $default_image_fid : 0, - ), - 'widget' => array( - 'module' => 'image', - 'type' => 'image_image', - 'settings' => array( - 'progress_indicator' => 'throbber', - 'preview_image_style' => 'thumbnail', - ), - 'weight' => -1, - ), - 'display' => array( - 'default' => array( - 'label' => 'hidden', - 'type' => $formatter, - 'settings' => array( - 'image_style' => 'thumbnail', - 'image_link' => 'content', - ), - ), - 'compact' => array( - 'label' => 'hidden', - 'type' => $formatter, - 'settings' => array( - 'image_style' => update_variable_get('user_picture_style', ''), - 'image_link' => 'content', - ), - ), - ), ); - _update_7000_field_create_instance($field, $instance); + + $field = _user_install_picture_field($settings); // Add file usage for the default field. if (!empty($default_image_fid)) { @@ -1104,3 +966,79 @@ function user_update_8016() { /** * @} End of "addtogroup updates-7.x-to-8.x". */ + +/** + * Creates a user picture image field for the User entity. + */ +function _user_install_picture_field(array $settings = array()) { + $t = get_t(); + $settings += array( + 'formatter' => 'image', + 'file_directory' => 'pictures', + 'default_image' => 0, + 'image_style' => 'thumbnail', + 'max_resolution' => '85x85', + 'max_filesize' => '30 KB', + 'description' => $t('Your virtual face or picture.'), + ); + + $field = array( + 'field_name' => 'user_picture', + 'module' => 'image', + 'type' => 'image', + 'cardinality' => 1, + 'locked' => FALSE, + 'indexes' => array('fid' => array('fid')), + 'settings' => array( + 'uri_scheme' => 'public', + 'default_image' => FALSE, + ), + 'storage' => array( + 'type' => 'field_sql_storage', + 'settings' => array(), + ), + ); + _update_7000_field_create_field($field); + + $instance = array( + 'field_name' => 'user_picture', + 'entity_type' => 'user', + 'label' => 'Picture', + 'bundle' => 'user', + 'description' => $settings['description'], + 'required' => FALSE, + 'settings' => array( + 'file_extensions' => 'png gif jpg jpeg', + 'file_directory' => $settings['file_directory'], + 'max_filesize' => $settings['max_filesize'], + 'alt_field' => 0, + 'title_field' => 0, + 'max_resolution' => $settings['max_resolution'], + 'min_resolution' => '', + 'default_image' => $settings['default_image'], + ), + 'widget' => array( + 'module' => 'image', + 'type' => 'image_image', + 'settings' => array( + 'progress_indicator' => 'throbber', + 'preview_image_style' => 'thumbnail', + ), + 'weight' => -1, + ), + 'display' => array( + 'default' => array( + 'label' => 'hidden', + 'type' => $settings['formatter'], + 'settings' => array('image_style' => 'thumbnail', 'image_link' => 'content'), + ), + 'compact' => array( + 'label' => 'hidden', + 'type' => $settings['formatter'], + 'settings' => array('image_style' => $settings['image_style'], 'image_link' => 'content'), + ), + ), + ); + _update_7000_field_create_instance($field, $instance); + return $field; +} diff --git a/core/modules/user/user.module b/core/modules/user/user.module index 285b9a7..fe2b6a0 100644 --- a/core/modules/user/user.module +++ b/core/modules/user/user.module @@ -979,30 +979,20 @@ function user_register_access() { * Can either be a full user object or a $uid. */ function user_view_access($account) { - $uid = is_object($account) ? $account->uid : (int) $account; - - // Never allow access to view the anonymous user account. - if ($uid) { - // Admins can view all, users can view own profiles at all times. - if ($GLOBALS['user']->uid == $uid || user_access('administer users')) { - return TRUE; - } - elseif (user_access('access user profiles')) { - // At this point, load the complete account object. - if (!is_object($account)) { - $account = user_load($uid); - } - return (is_object($account) && $account->status); - } + if (is_numeric($account)) { + $account = user_load($account); } - return FALSE; + return $account->access('view'); } /** * Access callback for user account editing. */ function user_edit_access($account) { - return (($GLOBALS['user']->uid == $account->uid) || user_access('administer users')) && $account->uid > 0; + if (is_numeric($account)) { + $account = user_load($account); + } + return $account->access('edit'); } /** @@ -1012,7 +1002,10 @@ function user_edit_access($account) { * users, and prevent the anonymous user from cancelling the account. */ function user_cancel_access($account) { - return ((($GLOBALS['user']->uid == $account->uid) && user_access('cancel account')) || user_access('administer users')) && $account->uid > 0; + if (is_numeric($account)) { + $account = user_load($account); + } + return $account->access('delete'); } /** diff --git a/core/modules/views/lib/Drupal/views/Plugin/Core/Entity/View.php b/core/modules/views/lib/Drupal/views/Plugin/Core/Entity/View.php index ad518b8..f31dcae 100644 --- a/core/modules/views/lib/Drupal/views/Plugin/Core/Entity/View.php +++ b/core/modules/views/lib/Drupal/views/Plugin/Core/Entity/View.php @@ -371,29 +371,4 @@ public function getPaths() { return array_unique($all_paths); } - /** - * Overrides \Drupal\Core\Config\Entity\ConfigEntityBase::getExportProperties(); - */ - public function getExportProperties() { - $names = array( - 'api_version', - 'base_field', - 'base_table', - 'core', - 'description', - 'disabled', - 'display', - 'human_name', - 'module', - 'name', - 'tag', - 'uuid', - ); - $properties = array(); - foreach ($names as $name) { - $properties[$name] = $this->get($name); - } - return $properties; - } - } diff --git a/core/modules/views/lib/Drupal/views/Plugin/Type/PluginManager.php b/core/modules/views/lib/Drupal/views/Plugin/Type/PluginManager.php index f492034..354c106 100644 --- a/core/modules/views/lib/Drupal/views/Plugin/Type/PluginManager.php +++ b/core/modules/views/lib/Drupal/views/Plugin/Type/PluginManager.php @@ -30,8 +30,22 @@ public function __construct($type) { 'parent' => 'parent', 'plugin_type' => $type, 'module' => 'views', - 'register_theme' => TRUE, ); } + /** + * Overrides Drupal\Component\Plugin\PluginManagerBase::processDefinition(). + */ + public function processDefinition(&$definition, $plugin_id) { + parent::processDefinition($definition, $plugin_id); + + // Setup automatic path/file finding for theme registration. + if ($definition['module'] == 'views' || isset($definition['theme'])) { + $definition += array( + 'theme path' => drupal_get_path('module', 'views') . '/theme', + 'theme file' => 'theme.inc', + ); + } + } + } diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/PluginBase.php b/core/modules/views/lib/Drupal/views/Plugin/views/PluginBase.php index 36b1a01..c045b7d 100644 --- a/core/modules/views/lib/Drupal/views/Plugin/views/PluginBase.php +++ b/core/modules/views/lib/Drupal/views/Plugin/views/PluginBase.php @@ -180,6 +180,19 @@ public function themeFunctions() { } /** + * Provide a list of additional theme functions for the theme information page + */ + public function additionalThemeFunctions() { + $funcs = array(); + if (!empty($this->definition['additional themes'])) { + foreach ($this->definition['additional themes'] as $theme => $type) { + $funcs[] = views_theme_functions($theme, $this->view, $this->view->display_handler->display); + } + } + return $funcs; + } + + /** * Validate that the plugin is correct and can be saved. * * @return diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php b/core/modules/views/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php index 91da345..5f5cfe1 100644 --- a/core/modules/views/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php +++ b/core/modules/views/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php @@ -1762,16 +1762,34 @@ public function buildOptionsForm(&$form, &$form_state) { // delegates to the style. if (!empty($this->definition['theme'])) { $funcs[] = $this->optionLink(t('Display output'), 'analyze-theme-display') . ': ' . $this->formatThemes($this->themeFunctions()); + $themes = $this->additionalThemeFunctions(); + if ($themes) { + foreach ($themes as $theme) { + $funcs[] = $this->optionLink(t('Alternative display output'), 'analyze-theme-display') . ': ' . $this->formatThemes($theme); + } + } } $plugin = $this->getPlugin('style'); if ($plugin) { - $funcs[] = $this->optionLink(t('Style output'), 'analyze-theme-style') . ': ' . $this->formatThemes($plugin->themeFunctions()); + $funcs[] = $this->optionLink(t('Style output'), 'analyze-theme-style') . ': ' . $this->formatThemes($plugin->themeFunctions(), $plugin->additionalThemeFunctions()); + $themes = $plugin->additionalThemeFunctions(); + if ($themes) { + foreach ($themes as $theme) { + $funcs[] = $this->optionLink(t('Alternative style'), 'analyze-theme-style') . ': ' . $this->formatThemes($theme); + } + } if ($plugin->usesRowPlugin()) { $row_plugin = $this->getPlugin('row'); if ($row_plugin) { $funcs[] = $this->optionLink(t('Row style output'), 'analyze-theme-row') . ': ' . $this->formatThemes($row_plugin->themeFunctions()); + $themes = $row_plugin->additionalThemeFunctions(); + if ($themes) { + foreach ($themes as $theme) { + $funcs[] = $this->optionLink(t('Alternative row style'), 'analyze-theme-row') . ': ' . $this->formatThemes($theme); + } + } } } @@ -1845,7 +1863,14 @@ public function buildOptionsForm(&$form, &$form_state) { } else { $output .= '

' . t('This is the default theme template used for this display.') . '

'; - $output .= '
' . check_plain(file_get_contents('./' . $this->definition['theme_path'] . '/' . strtr($this->definition['theme'], '_', '-') . '.tpl.php')) . '
'; + $output .= '
' . check_plain(file_get_contents('./' . $this->definition['theme path'] . '/' . strtr($this->definition['theme'], '_', '-') . '.tpl.php')) . '
'; + } + + if (!empty($this->definition['additional themes'])) { + foreach ($this->definition['additional themes'] as $theme => $type) { + $output .= '

' . t('This is an alternative template for this display.') . '

'; + $output .= '
' . check_plain(file_get_contents('./' . $this->definition['theme path'] . '/' . strtr($theme, '_', '-') . '.tpl.php')) . '
'; + } } $form['analysis'] = array( @@ -1865,7 +1890,14 @@ public function buildOptionsForm(&$form, &$form_state) { } else { $output .= '

' . t('This is the default theme template used for this style.') . '

'; - $output .= '
' . check_plain(file_get_contents('./' . $plugin->definition['theme_path'] . '/' . strtr($plugin->definition['theme'], '_', '-') . '.tpl.php')) . '
'; + $output .= '
' . check_plain(file_get_contents('./' . $plugin->definition['theme path'] . '/' . strtr($plugin->definition['theme'], '_', '-') . '.tpl.php')) . '
'; + } + + if (!empty($plugin->definition['additional themes'])) { + foreach ($plugin->definition['additional themes'] as $theme => $type) { + $output .= '

' . t('This is an alternative template for this style.') . '

'; + $output .= '
' . check_plain(file_get_contents('./' . $plugin->definition['theme path'] . '/' . strtr($theme, '_', '-') . '.tpl.php')) . '
'; + } } $form['analysis'] = array( @@ -1885,7 +1917,14 @@ public function buildOptionsForm(&$form, &$form_state) { } else { $output .= '

' . t('This is the default theme template used for this row style.') . '

'; - $output .= '
' . check_plain(file_get_contents('./' . $plugin->definition['theme_path'] . '/' . strtr($plugin->definition['theme'], '_', '-') . '.tpl.php')) . '
'; + $output .= '
' . check_plain(file_get_contents('./' . $plugin->definition['theme path'] . '/' . strtr($plugin->definition['theme'], '_', '-') . '.tpl.php')) . '
'; + } + + if (!empty($plugin->definition['additional themes'])) { + foreach ($plugin->definition['additional themes'] as $theme => $type) { + $output .= '

' . t('This is an alternative template for this row style.') . '

'; + $output .= '
' . check_plain(file_get_contents('./' . $plugin->definition['theme path'] . '/' . strtr($theme, '_', '-') . '.tpl.php')) . '
'; + } } $form['analysis'] = array( @@ -1902,7 +1941,7 @@ public function buildOptionsForm(&$form, &$form_state) { // Field templates aren't registered the normal way...and they're always // this one, anyhow. - $output .= '
' . check_plain(file_get_contents(drupal_get_path('module', 'views') . '/templates/views-view-field.tpl.php')) . '
'; + $output .= '
' . check_plain(file_get_contents(drupal_get_path('module', 'views') . '/theme/views-view-field.tpl.php')) . '
'; $form['analysis'] = array( '#markup' => '
' . $output . '
', diff --git a/core/modules/comment/lib/Drupal/comment/Tests/Views/ArgumentUserUIDTest.php b/core/modules/views/lib/Drupal/views/Tests/Comment/ArgumentUserUIDTest.php similarity index 90% rename from core/modules/comment/lib/Drupal/comment/Tests/Views/ArgumentUserUIDTest.php rename to core/modules/views/lib/Drupal/views/Tests/Comment/ArgumentUserUIDTest.php index 41fae33..6494b90 100644 --- a/core/modules/comment/lib/Drupal/comment/Tests/Views/ArgumentUserUIDTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/Comment/ArgumentUserUIDTest.php @@ -2,10 +2,10 @@ /** * @file - * Contains \Drupal\comment\Tests\Views\ArgumentUserUIDTest. + * Definition of Drupal\views\Tests\Comment\ArgumentUserUIDTest. */ -namespace Drupal\comment\Tests\Views; +namespace Drupal\views\Tests\Comment; /** * Tests the argument_comment_user_uid handler. diff --git a/core/modules/comment/lib/Drupal/comment/Tests/Views/CommentTestBase.php b/core/modules/views/lib/Drupal/views/Tests/Comment/CommentTestBase.php similarity index 76% rename from core/modules/comment/lib/Drupal/comment/Tests/Views/CommentTestBase.php rename to core/modules/views/lib/Drupal/views/Tests/Comment/CommentTestBase.php index 0f2d7ae..c51e0f1 100644 --- a/core/modules/comment/lib/Drupal/comment/Tests/Views/CommentTestBase.php +++ b/core/modules/views/lib/Drupal/views/Tests/Comment/CommentTestBase.php @@ -2,13 +2,12 @@ /** * @file - * Contains \Drupal\comment\Tests\Views\CommentTestBase. + * Definition of Drupal\views\Tests\Comment\CommentTestBase. */ -namespace Drupal\comment\Tests\Views; +namespace Drupal\views\Tests\Comment; use Drupal\views\Tests\ViewTestBase; -use Drupal\views\Tests\ViewTestData; /** * Tests the argument_comment_user_uid handler. @@ -20,13 +19,11 @@ * * @var array */ - public static $modules = array('comment', 'comment_test_views'); + public static $modules = array('comment'); function setUp() { parent::setUp(); - ViewTestData::importTestViews(get_class($this), array('comment_test_views')); - // Add two users, create a node with the user1 as author and another node // with user2 as author. For the second node add a comment from user1. $this->account = $this->drupalCreateUser(); diff --git a/core/modules/comment/lib/Drupal/comment/Tests/Views/DefaultViewRecentComments.php b/core/modules/views/lib/Drupal/views/Tests/Comment/DefaultViewRecentComments.php similarity index 97% rename from core/modules/comment/lib/Drupal/comment/Tests/Views/DefaultViewRecentComments.php rename to core/modules/views/lib/Drupal/views/Tests/Comment/DefaultViewRecentComments.php index b8e7d75..73ddfe0 100644 --- a/core/modules/comment/lib/Drupal/comment/Tests/Views/DefaultViewRecentComments.php +++ b/core/modules/views/lib/Drupal/views/Tests/Comment/DefaultViewRecentComments.php @@ -2,10 +2,10 @@ /** * @file - * Contains \Drupal\comment\Tests\Views\DefaultViewRecentComments. + * Definition of Drupal\views\Tests\Comment\DefaultViewRecentComments. */ -namespace Drupal\comment\Tests\Views; +namespace Drupal\views\Tests\Comment; use Drupal\entity\DatabaseStorageController; use Drupal\views\Tests\ViewTestBase; diff --git a/core/modules/comment/lib/Drupal/comment/Tests/Views/FilterUserUIDTest.php b/core/modules/views/lib/Drupal/views/Tests/Comment/FilterUserUIDTest.php similarity index 92% rename from core/modules/comment/lib/Drupal/comment/Tests/Views/FilterUserUIDTest.php rename to core/modules/views/lib/Drupal/views/Tests/Comment/FilterUserUIDTest.php index 514ceb3..271711f 100644 --- a/core/modules/comment/lib/Drupal/comment/Tests/Views/FilterUserUIDTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/Comment/FilterUserUIDTest.php @@ -2,10 +2,10 @@ /** * @file - * Contains \Drupal\comment\Tests\Views\FilterUserUIDTest. + * Definition of Drupal\views\Tests\Comment\FilterUserUIDTest. */ -namespace Drupal\comment\Tests\Views; +namespace Drupal\views\Tests\Comment; /** * Tests the filter_comment_user_uid handler. diff --git a/core/modules/comment/lib/Drupal/comment/Tests/Views/WizardTest.php b/core/modules/views/lib/Drupal/views/Tests/Comment/WizardTest.php similarity index 96% rename from core/modules/comment/lib/Drupal/comment/Tests/Views/WizardTest.php rename to core/modules/views/lib/Drupal/views/Tests/Comment/WizardTest.php index d7ad6cf..834bd5b 100644 --- a/core/modules/comment/lib/Drupal/comment/Tests/Views/WizardTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/Comment/WizardTest.php @@ -2,10 +2,10 @@ /** * @file - * Contains \Drupal\comment\Tests\Views\WizardTest. + * Definition of Drupal\views\Tests\Comment\WizardTest. */ -namespace Drupal\comment\Tests\Views; +namespace Drupal\views\Tests\Comment; use Drupal\views\Tests\Wizard\WizardTestBase; diff --git a/core/modules/field/lib/Drupal/field/Tests/Views/ApiDataTest.php b/core/modules/views/lib/Drupal/views/Tests/Field/ApiDataTest.php similarity index 98% rename from core/modules/field/lib/Drupal/field/Tests/Views/ApiDataTest.php rename to core/modules/views/lib/Drupal/views/Tests/Field/ApiDataTest.php index 6056996..abb1ad4 100644 --- a/core/modules/field/lib/Drupal/field/Tests/Views/ApiDataTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/Field/ApiDataTest.php @@ -2,10 +2,10 @@ /** * @file - * Contains \Drupal\field\Tests\Views\ApiDataTest. + * Definition of Drupal\views\Test\Field\ApiDataTest. */ -namespace Drupal\field\Tests\Views; +namespace Drupal\views\Tests\Field; /** * Test the produced views_data. diff --git a/core/modules/field/lib/Drupal/field/Tests/Views/FieldTestBase.php b/core/modules/views/lib/Drupal/views/Tests/Field/FieldTestBase.php similarity index 82% rename from core/modules/field/lib/Drupal/field/Tests/Views/FieldTestBase.php rename to core/modules/views/lib/Drupal/views/Tests/Field/FieldTestBase.php index d63272a..7ab6e72 100644 --- a/core/modules/field/lib/Drupal/field/Tests/Views/FieldTestBase.php +++ b/core/modules/views/lib/Drupal/views/Tests/Field/FieldTestBase.php @@ -2,7 +2,7 @@ /** * @file - * Contains \Drupal\field\Tests\Views\FieldTestBase. + * Definition of Drupal\views\Test\Field\FieldTestBase. */ /** @@ -16,10 +16,9 @@ * - Use relationships between different entity types, for example node and the node author(user). */ -namespace Drupal\field\Tests\Views; +namespace Drupal\views\Tests\Field; use Drupal\views\Tests\ViewTestBase; -use Drupal\views\Tests\ViewTestData; /** * Provides some helper methods for testing fieldapi integration into views. @@ -27,13 +26,6 @@ abstract class FieldTestBase extends ViewTestBase { /** - * Modules to enable. - * - * @var array - */ - public static $modules = array('field_test_views'); - - /** * Stores the field definitions used by the test. * @var array */ @@ -45,12 +37,6 @@ */ public $instances; - protected function setUp() { - parent::setUp(); - - ViewTestData::importTestViews(get_class($this), array('field_test_views')); - } - function setUpFields($amount = 3) { // Create three fields. $field_names = array(); diff --git a/core/modules/field/lib/Drupal/field/Tests/Views/HandlerFieldFieldTest.php b/core/modules/views/lib/Drupal/views/Tests/Field/HandlerFieldFieldTest.php similarity index 98% rename from core/modules/field/lib/Drupal/field/Tests/Views/HandlerFieldFieldTest.php rename to core/modules/views/lib/Drupal/views/Tests/Field/HandlerFieldFieldTest.php index caacce2..8f294dd 100644 --- a/core/modules/field/lib/Drupal/field/Tests/Views/HandlerFieldFieldTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/Field/HandlerFieldFieldTest.php @@ -2,10 +2,10 @@ /** * @file - * Contains \Drupal\field\Tests\Views\HandlerFieldFieldTest. + * Definition of Drupal\views\Test\Field\HandlerFieldFieldTest. */ -namespace Drupal\field\Tests\Views; +namespace Drupal\views\Tests\Field; use Drupal\views\ViewExecutable; diff --git a/core/modules/language/lib/Drupal/language/Tests/Views/ArgumentLanguageTest.php b/core/modules/views/lib/Drupal/views/Tests/Language/ArgumentLanguageTest.php similarity index 92% rename from core/modules/language/lib/Drupal/language/Tests/Views/ArgumentLanguageTest.php rename to core/modules/views/lib/Drupal/views/Tests/Language/ArgumentLanguageTest.php index eead47e..dc14e8f 100644 --- a/core/modules/language/lib/Drupal/language/Tests/Views/ArgumentLanguageTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/Language/ArgumentLanguageTest.php @@ -2,10 +2,10 @@ /** * @file - * Contains \Drupal\language\Tests\Views\ArgumentLanguageTest. + * Contains Drupal\views\Tests\Language\ArgumentLanguageTest. */ -namespace Drupal\language\Tests\Views; +namespace Drupal\views\Tests\Language; use Drupal\Core\Language\Language; diff --git a/core/modules/language/lib/Drupal/language/Tests/Views/FieldLanguageTest.php b/core/modules/views/lib/Drupal/views/Tests/Language/FieldLanguageTest.php similarity index 91% rename from core/modules/language/lib/Drupal/language/Tests/Views/FieldLanguageTest.php rename to core/modules/views/lib/Drupal/views/Tests/Language/FieldLanguageTest.php index 1eafc88..1c3c8d4 100644 --- a/core/modules/language/lib/Drupal/language/Tests/Views/FieldLanguageTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/Language/FieldLanguageTest.php @@ -2,10 +2,10 @@ /** * @file - * Contains \Drupal\language\Tests\Views\FieldLanguageTest. + * Contains Drupal\views\Tests\Language\FieldLanguageTest. */ -namespace Drupal\language\Tests\Views; +namespace Drupal\views\Tests\Language; use Drupal\Core\Language\Language; diff --git a/core/modules/language/lib/Drupal/language/Tests/Views/FilterLanguageTest.php b/core/modules/views/lib/Drupal/views/Tests/Language/FilterLanguageTest.php similarity index 92% rename from core/modules/language/lib/Drupal/language/Tests/Views/FilterLanguageTest.php rename to core/modules/views/lib/Drupal/views/Tests/Language/FilterLanguageTest.php index 16645a2..de1d093 100644 --- a/core/modules/language/lib/Drupal/language/Tests/Views/FilterLanguageTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/Language/FilterLanguageTest.php @@ -2,10 +2,10 @@ /** * @file - * Contains \Drupal\language\Tests\Views\FilterLanguageTest. + * Contains Drupal\views\Tests\Language\FilterLanguageTest. */ -namespace Drupal\language\Tests\Views; +namespace Drupal\views\Tests\Language; use Drupal\Core\Language\Language; diff --git a/core/modules/language/lib/Drupal/language/Tests/Views/LanguageTestBase.php b/core/modules/views/lib/Drupal/views/Tests/Language/LanguageTestBase.php similarity index 94% rename from core/modules/language/lib/Drupal/language/Tests/Views/LanguageTestBase.php rename to core/modules/views/lib/Drupal/views/Tests/Language/LanguageTestBase.php index e84844b..c5f7c7b 100644 --- a/core/modules/language/lib/Drupal/language/Tests/Views/LanguageTestBase.php +++ b/core/modules/views/lib/Drupal/views/Tests/Language/LanguageTestBase.php @@ -2,10 +2,10 @@ /** * @file - * Contains \Drupal\language\Tests\Views\LanguageTestBase. + * Contains Drupal\views\Tests\Language\LanguageTestBase. */ -namespace Drupal\language\Tests\Views; +namespace Drupal\views\Tests\Language; use Drupal\views\Tests\ViewUnitTestBase; use Drupal\Core\Language\Language; diff --git a/core/modules/node/lib/Drupal/node/Tests/Views/FieldTypeTest.php b/core/modules/views/lib/Drupal/views/Tests/Node/FieldTypeTest.php similarity index 91% rename from core/modules/node/lib/Drupal/node/Tests/Views/FieldTypeTest.php rename to core/modules/views/lib/Drupal/views/Tests/Node/FieldTypeTest.php index 0f89752..9aad9af 100644 --- a/core/modules/node/lib/Drupal/node/Tests/Views/FieldTypeTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/Node/FieldTypeTest.php @@ -2,10 +2,10 @@ /** * @file - * Contains \Drupal\node\Tests\Views\FieldTypeTest. + * Definition of Drupal\views\Tests\Node\FieldTypeTest. */ -namespace Drupal\node\Tests\Views; +namespace Drupal\views\Tests\Node; /** * Tests the Drupal\node\Plugin\views\field\Type handler. diff --git a/core/modules/node/lib/Drupal/node/Tests/Views/FilterUidRevisionTest.php b/core/modules/views/lib/Drupal/views/Tests/Node/FilterUidRevisionTest.php similarity index 94% rename from core/modules/node/lib/Drupal/node/Tests/Views/FilterUidRevisionTest.php rename to core/modules/views/lib/Drupal/views/Tests/Node/FilterUidRevisionTest.php index 5931094..01192fa 100644 --- a/core/modules/node/lib/Drupal/node/Tests/Views/FilterUidRevisionTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/Node/FilterUidRevisionTest.php @@ -2,10 +2,10 @@ /** * @file - * Contains \Drupal\node\Tests\Views\FilterUidRevisionTest. + * Definition of Drupal\views\Tests\Comment\FilterUidRevisionTest. */ -namespace Drupal\node\Tests\Views; +namespace Drupal\views\Tests\Node; /** * Tests the node_uid_revision handler. diff --git a/core/modules/views/lib/Drupal/views/Tests/Node/NodeTestBase.php b/core/modules/views/lib/Drupal/views/Tests/Node/NodeTestBase.php new file mode 100644 index 0000000..17bbc79 --- /dev/null +++ b/core/modules/views/lib/Drupal/views/Tests/Node/NodeTestBase.php @@ -0,0 +1,16 @@ +mockStandardInstall(); - ViewTestData::importTestViews(get_class($this), array('taxonomy_test_views')); - $this->term1 = $this->createTerm(); $this->term2 = $this->createTerm(); diff --git a/core/modules/user/lib/Drupal/user/Tests/Views/AccessPermissionTest.php b/core/modules/views/lib/Drupal/views/Tests/User/AccessPermissionTest.php similarity index 92% rename from core/modules/user/lib/Drupal/user/Tests/Views/AccessPermissionTest.php rename to core/modules/views/lib/Drupal/views/Tests/User/AccessPermissionTest.php index 9e85182..62a88c1 100644 --- a/core/modules/user/lib/Drupal/user/Tests/Views/AccessPermissionTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/User/AccessPermissionTest.php @@ -2,10 +2,10 @@ /** * @file - * Contains \Drupal\user\Tests\Views\AccessPermissionTest. + * Definition of Drupal\views\Tests\User\AccessPermissionTest. */ -namespace Drupal\user\Tests\Views; +namespace Drupal\views\Tests\User; use Drupal\user\Plugin\views\access\Permission; diff --git a/core/modules/user/lib/Drupal/user/Tests/Views/AccessRoleTest.php b/core/modules/views/lib/Drupal/views/Tests/User/AccessRoleTest.php similarity index 93% rename from core/modules/user/lib/Drupal/user/Tests/Views/AccessRoleTest.php rename to core/modules/views/lib/Drupal/views/Tests/User/AccessRoleTest.php index dce8699..319918b 100644 --- a/core/modules/user/lib/Drupal/user/Tests/Views/AccessRoleTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/User/AccessRoleTest.php @@ -2,10 +2,10 @@ /** * @file - * Contains \Drupal\user\Tests\Views\AccessRoleTest. + * Definition of Drupal\views\Tests\User\AccessRoleTest. */ -namespace Drupal\user\Tests\Views; +namespace Drupal\views\Tests\User; use Drupal\user\Plugin\views\access\Role; diff --git a/core/modules/user/lib/Drupal/user/Tests/Views/AccessTestBase.php b/core/modules/views/lib/Drupal/views/Tests/User/AccessTestBase.php similarity index 93% rename from core/modules/user/lib/Drupal/user/Tests/Views/AccessTestBase.php rename to core/modules/views/lib/Drupal/views/Tests/User/AccessTestBase.php index 5455eaa..8d03700 100644 --- a/core/modules/user/lib/Drupal/user/Tests/Views/AccessTestBase.php +++ b/core/modules/views/lib/Drupal/views/Tests/User/AccessTestBase.php @@ -2,10 +2,10 @@ /** * @file - * Contains \Drupal\user\Tests\Views\AccessTestBase. + * Definition of Drupal\views\Tests\Uses\AccessTestBase. */ -namespace Drupal\user\Tests\Views; +namespace Drupal\views\Tests\User; /** * A common test base class for the user access plugin tests. diff --git a/core/modules/user/lib/Drupal/user/Tests/Views/ArgumentDefaultTest.php b/core/modules/views/lib/Drupal/views/Tests/User/ArgumentDefaultTest.php similarity index 92% rename from core/modules/user/lib/Drupal/user/Tests/Views/ArgumentDefaultTest.php rename to core/modules/views/lib/Drupal/views/Tests/User/ArgumentDefaultTest.php index a52aecd..85d84e2 100644 --- a/core/modules/user/lib/Drupal/user/Tests/Views/ArgumentDefaultTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/User/ArgumentDefaultTest.php @@ -2,10 +2,10 @@ /** * @file - * Contains \Drupal\user\Tests\Views\ArgumentDefaultTest. + * Definition of Drupal\views\Tests\User\ArgumentDefaultTest. */ -namespace Drupal\user\Tests\Views; +namespace Drupal\views\Tests\User; /** * Tests views user argument default plugin. diff --git a/core/modules/user/lib/Drupal/user/Tests/Views/ArgumentValidateTest.php b/core/modules/views/lib/Drupal/views/Tests/User/ArgumentValidateTest.php similarity index 97% rename from core/modules/user/lib/Drupal/user/Tests/Views/ArgumentValidateTest.php rename to core/modules/views/lib/Drupal/views/Tests/User/ArgumentValidateTest.php index 239134b..acaee79 100644 --- a/core/modules/user/lib/Drupal/user/Tests/Views/ArgumentValidateTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/User/ArgumentValidateTest.php @@ -2,10 +2,10 @@ /** * @file - * Contains \Drupal\user\Tests\Views\ArgumentValidateTest. + * Definition of Drupal\views\Tests\User\ArgumentValidateTest. */ -namespace Drupal\user\Tests\Views; +namespace Drupal\views\Tests\User; /** * Tests views user argument validator plugin. diff --git a/core/modules/user/lib/Drupal/user/Tests/Views/HandlerArgumentUserUidTest.php b/core/modules/views/lib/Drupal/views/Tests/User/HandlerArgumentUserUidTest.php similarity index 90% rename from core/modules/user/lib/Drupal/user/Tests/Views/HandlerArgumentUserUidTest.php rename to core/modules/views/lib/Drupal/views/Tests/User/HandlerArgumentUserUidTest.php index 9d0f30f..c09e7f0 100644 --- a/core/modules/user/lib/Drupal/user/Tests/Views/HandlerArgumentUserUidTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/User/HandlerArgumentUserUidTest.php @@ -2,10 +2,10 @@ /** * @file - * Contains \Drupal\user\Tests\Views\HandlerArgumentUserUidTest. + * Definition of Drupal\views\Tests\User\HandlerArgumentUserUidTest. */ -namespace Drupal\user\Tests\Views; +namespace Drupal\views\Tests\User; /** * Tests views user uid argument handler. diff --git a/core/modules/user/lib/Drupal/user/Tests/Views/HandlerFieldUserNameTest.php b/core/modules/views/lib/Drupal/views/Tests/User/HandlerFieldUserNameTest.php similarity index 95% rename from core/modules/user/lib/Drupal/user/Tests/Views/HandlerFieldUserNameTest.php rename to core/modules/views/lib/Drupal/views/Tests/User/HandlerFieldUserNameTest.php index e7ba95a..a0add02 100644 --- a/core/modules/user/lib/Drupal/user/Tests/Views/HandlerFieldUserNameTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/User/HandlerFieldUserNameTest.php @@ -2,10 +2,10 @@ /** * @file - * Contains \Drupal\user\Tests\Views\HandlerFieldUserNameTest. + * Definition of Drupal\views\Tests\User\HandlerFieldUserNameTest. */ -namespace Drupal\user\Tests\Views; +namespace Drupal\views\Tests\User; /** * Tests the field username handler. diff --git a/core/modules/user/lib/Drupal/user/Tests/Views/HandlerFilterUserNameTest.php b/core/modules/views/lib/Drupal/views/Tests/User/HandlerFilterUserNameTest.php similarity index 95% rename from core/modules/user/lib/Drupal/user/Tests/Views/HandlerFilterUserNameTest.php rename to core/modules/views/lib/Drupal/views/Tests/User/HandlerFilterUserNameTest.php index 45a1424..9fec606 100644 --- a/core/modules/user/lib/Drupal/user/Tests/Views/HandlerFilterUserNameTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/User/HandlerFilterUserNameTest.php @@ -2,13 +2,12 @@ /** * @file - * Contains \Drupal\user\Tests\Views\HandlerFilterUserNameTest. + * Definition of Drupal\views\Tests\User\HandlerFilterUserNameTest. */ -namespace Drupal\user\Tests\Views; +namespace Drupal\views\Tests\User; use Drupal\views\Tests\ViewTestBase; -use Drupal\views\Tests\ViewTestData; /** * Tests the handler of the user: name filter. @@ -18,18 +17,18 @@ class HandlerFilterUserNameTest extends ViewTestBase { /** - * Modules to enable. + * Views used by this test. * * @var array */ - public static $modules = array('views_ui', 'user_test_views'); + public static $testViews = array('test_user_name'); /** - * Views used by this test. + * Modules to enable. * * @var array */ - public static $testViews = array('test_user_name'); + public static $modules = array('views_ui'); /** * Accounts used by this test. @@ -65,8 +64,6 @@ public static function getInfo() { protected function setUp() { parent::setUp(); - ViewTestData::importTestViews(get_class($this), array('user_test_views')); - $this->enableViewsTestModule(); $this->accounts = array(); diff --git a/core/modules/user/lib/Drupal/user/Tests/Views/RelationshipRepresentativeNode.php b/core/modules/views/lib/Drupal/views/Tests/User/RelationshipRepresentativeNode.php similarity index 90% rename from core/modules/user/lib/Drupal/user/Tests/Views/RelationshipRepresentativeNode.php rename to core/modules/views/lib/Drupal/views/Tests/User/RelationshipRepresentativeNode.php index 9c75e34..a130ce7 100644 --- a/core/modules/user/lib/Drupal/user/Tests/Views/RelationshipRepresentativeNode.php +++ b/core/modules/views/lib/Drupal/views/Tests/User/RelationshipRepresentativeNode.php @@ -2,10 +2,10 @@ /** * @file - * Contains \Drupal\user\Tests\Views\RelationshipRepresentativeNode. + * Definition of Drupal\views\Tests\User\RelationshipRepresentativeNode. */ -namespace Drupal\user\Tests\Views; +namespace Drupal\views\Tests\User; /** * Tests the representative node relationship for users. diff --git a/core/modules/user/lib/Drupal/user/Tests/Views/UserTestBase.php b/core/modules/views/lib/Drupal/views/Tests/User/UserTestBase.php similarity index 66% rename from core/modules/user/lib/Drupal/user/Tests/Views/UserTestBase.php rename to core/modules/views/lib/Drupal/views/Tests/User/UserTestBase.php index 6ea9454..2782987 100644 --- a/core/modules/user/lib/Drupal/user/Tests/Views/UserTestBase.php +++ b/core/modules/views/lib/Drupal/views/Tests/User/UserTestBase.php @@ -2,13 +2,12 @@ /** * @file - * Contains \Drupal\user\Tests\Views\UserTestBase. + * Definition of Drupal\views\Tests\User\UserTestBase. */ -namespace Drupal\user\Tests\Views; +namespace Drupal\views\Tests\User; use Drupal\views\Tests\ViewTestBase; -use Drupal\views\Tests\ViewTestData; /** * @todo. @@ -16,13 +15,6 @@ abstract class UserTestBase extends ViewTestBase { /** - * Modules to enable. - * - * @var array - */ - public static $modules = array('user_test_views'); - - /** * Users to use during this test. * * @var array @@ -39,8 +31,6 @@ protected function setUp() { parent::setUp(); - ViewTestData::importTestViews(get_class($this), array('user_test_views')); - $this->users[] = $this->drupalCreateUser(); $this->users[] = user_load(1); $this->nodes[] = $this->drupalCreateNode(array('uid' => $this->users[0]->uid)); diff --git a/core/modules/views/lib/Drupal/views/Tests/ViewTestBase.php b/core/modules/views/lib/Drupal/views/Tests/ViewTestBase.php index 93685aa..3628263 100644 --- a/core/modules/views/lib/Drupal/views/Tests/ViewTestBase.php +++ b/core/modules/views/lib/Drupal/views/Tests/ViewTestBase.php @@ -31,7 +31,7 @@ protected function setUp() { parent::setUp(); - ViewTestData::importTestViews(get_class($this), array('views_test_config')); + ViewTestData::importTestViews(get_class($this)); } /** diff --git a/core/modules/views/lib/Drupal/views/Tests/ViewTestData.php b/core/modules/views/lib/Drupal/views/Tests/ViewTestData.php index a33244e..e8c99e3 100644 --- a/core/modules/views/lib/Drupal/views/Tests/ViewTestData.php +++ b/core/modules/views/lib/Drupal/views/Tests/ViewTestData.php @@ -26,11 +26,12 @@ class ViewTestData { * The name of the test class. * @param array $modules * (optional) The module directories to look in for test views. - * Defaults to an empty array. + * The views_test_config module will always be checked. * * @see config_install_default_config() */ public static function importTestViews($class, $modules = array()) { + $modules[] = 'views_test_config'; $views = array(); while ($class) { if (property_exists($class, 'testViews')) { @@ -47,10 +48,6 @@ public static function importTestViews($class, $modules = array()) { ); foreach ($modules as $module) { $config_dir = drupal_get_path('module', $module) . '/test_views'; - if (!is_dir($config_dir) || !module_exists($module)) { - continue; - } - $source_storage = new FileStorage($config_dir); foreach ($source_storage->listAll() as $config_name) { list(, , $id) = explode('.', $config_name); diff --git a/core/modules/views/lib/Drupal/views/Tests/ViewUnitTestBase.php b/core/modules/views/lib/Drupal/views/Tests/ViewUnitTestBase.php index 738b97a..356346d 100644 --- a/core/modules/views/lib/Drupal/views/Tests/ViewUnitTestBase.php +++ b/core/modules/views/lib/Drupal/views/Tests/ViewUnitTestBase.php @@ -42,7 +42,7 @@ protected function setUp() { } $query->execute(); - ViewTestData::importTestViews(get_class($this), array('views_test_config')); + ViewTestData::importTestViews(get_class($this)); } /** diff --git a/core/modules/views/lib/Drupal/views/ViewStorageController.php b/core/modules/views/lib/Drupal/views/ViewStorageController.php index a3a3437..05268d2 100644 --- a/core/modules/views/lib/Drupal/views/ViewStorageController.php +++ b/core/modules/views/lib/Drupal/views/ViewStorageController.php @@ -99,4 +99,29 @@ protected function attachDisplays(EntityInterface $entity) { } } + /** + * Overrides Drupal\config\ConfigStorageController::getProperties(); + */ + protected function getProperties(EntityInterface $entity) { + $names = array( + 'api_version', + 'base_field', + 'base_table', + 'core', + 'description', + 'disabled', + 'display', + 'human_name', + 'module', + 'name', + 'tag', + 'uuid', + ); + $properties = array(); + foreach ($names as $name) { + $properties[$name] = $entity->get($name); + } + return $properties; + } + } diff --git a/core/modules/user/tests/user_test_views/test_views/views.view.test_access_perm.yml b/core/modules/views/tests/views_test_config/test_views/views.view.test_access_perm.yml similarity index 100% rename from core/modules/user/tests/user_test_views/test_views/views.view.test_access_perm.yml rename to core/modules/views/tests/views_test_config/test_views/views.view.test_access_perm.yml diff --git a/core/modules/user/tests/user_test_views/test_views/views.view.test_access_role.yml b/core/modules/views/tests/views_test_config/test_views/views.view.test_access_role.yml similarity index 100% rename from core/modules/user/tests/user_test_views/test_views/views.view.test_access_role.yml rename to core/modules/views/tests/views_test_config/test_views/views.view.test_access_role.yml diff --git a/core/modules/comment/tests/modules/comment_test_views/test_views/views.view.test_comment_user_uid.yml b/core/modules/views/tests/views_test_config/test_views/views.view.test_comment_user_uid.yml similarity index 100% rename from core/modules/comment/tests/modules/comment_test_views/test_views/views.view.test_comment_user_uid.yml rename to core/modules/views/tests/views_test_config/test_views/views.view.test_comment_user_uid.yml diff --git a/core/modules/node/tests/modules/node_test_views/test_views/views.view.test_filter_node_uid_revision.yml b/core/modules/views/tests/views_test_config/test_views/views.view.test_filter_node_uid_revision.yml similarity index 100% rename from core/modules/node/tests/modules/node_test_views/test_views/views.view.test_filter_node_uid_revision.yml rename to core/modules/views/tests/views_test_config/test_views/views.view.test_filter_node_uid_revision.yml diff --git a/core/modules/taxonomy/tests/modules/taxonomy_test_views/test_views/views.view.test_groupwise_term.yml b/core/modules/views/tests/views_test_config/test_views/views.view.test_groupwise_term.yml similarity index 100% rename from core/modules/taxonomy/tests/modules/taxonomy_test_views/test_views/views.view.test_groupwise_term.yml rename to core/modules/views/tests/views_test_config/test_views/views.view.test_groupwise_term.yml diff --git a/core/modules/user/tests/user_test_views/test_views/views.view.test_groupwise_user.yml b/core/modules/views/tests/views_test_config/test_views/views.view.test_groupwise_user.yml similarity index 100% rename from core/modules/user/tests/user_test_views/test_views/views.view.test_groupwise_user.yml rename to core/modules/views/tests/views_test_config/test_views/views.view.test_groupwise_user.yml diff --git a/core/modules/node/tests/modules/node_test_views/test_views/views.view.test_node_revision_nid.yml b/core/modules/views/tests/views_test_config/test_views/views.view.test_node_revision_nid.yml similarity index 100% rename from core/modules/node/tests/modules/node_test_views/test_views/views.view.test_node_revision_nid.yml rename to core/modules/views/tests/views_test_config/test_views/views.view.test_node_revision_nid.yml diff --git a/core/modules/node/tests/modules/node_test_views/test_views/views.view.test_node_revision_vid.yml b/core/modules/views/tests/views_test_config/test_views/views.view.test_node_revision_vid.yml similarity index 100% rename from core/modules/node/tests/modules/node_test_views/test_views/views.view.test_node_revision_vid.yml rename to core/modules/views/tests/views_test_config/test_views/views.view.test_node_revision_vid.yml diff --git a/core/modules/user/tests/user_test_views/test_views/views.view.test_plugin_argument_default_current_user.yml b/core/modules/views/tests/views_test_config/test_views/views.view.test_plugin_argument_default_current_user.yml similarity index 100% rename from core/modules/user/tests/user_test_views/test_views/views.view.test_plugin_argument_default_current_user.yml rename to core/modules/views/tests/views_test_config/test_views/views.view.test_plugin_argument_default_current_user.yml diff --git a/core/modules/node/tests/modules/node_test_views/test_views/views.view.test_status_extra.yml b/core/modules/views/tests/views_test_config/test_views/views.view.test_status_extra.yml similarity index 100% rename from core/modules/node/tests/modules/node_test_views/test_views/views.view.test_status_extra.yml rename to core/modules/views/tests/views_test_config/test_views/views.view.test_status_extra.yml diff --git a/core/modules/taxonomy/tests/modules/taxonomy_test_views/test_views/views.view.test_taxonomy_node_term_data.yml b/core/modules/views/tests/views_test_config/test_views/views.view.test_taxonomy_node_term_data.yml similarity index 100% rename from core/modules/taxonomy/tests/modules/taxonomy_test_views/test_views/views.view.test_taxonomy_node_term_data.yml rename to core/modules/views/tests/views_test_config/test_views/views.view.test_taxonomy_node_term_data.yml diff --git a/core/modules/user/tests/user_test_views/test_views/views.view.test_user_name.yml b/core/modules/views/tests/views_test_config/test_views/views.view.test_user_name.yml similarity index 100% rename from core/modules/user/tests/user_test_views/test_views/views.view.test_user_name.yml rename to core/modules/views/tests/views_test_config/test_views/views.view.test_user_name.yml diff --git a/core/modules/user/tests/user_test_views/test_views/views.view.test_user_relationship.yml b/core/modules/views/tests/views_test_config/test_views/views.view.test_user_relationship.yml similarity index 100% rename from core/modules/user/tests/user_test_views/test_views/views.view.test_user_relationship.yml rename to core/modules/views/tests/views_test_config/test_views/views.view.test_user_relationship.yml diff --git a/core/modules/user/tests/user_test_views/test_views/views.view.test_user_uid_argument.yml b/core/modules/views/tests/views_test_config/test_views/views.view.test_user_uid_argument.yml similarity index 100% rename from core/modules/user/tests/user_test_views/test_views/views.view.test_user_uid_argument.yml rename to core/modules/views/tests/views_test_config/test_views/views.view.test_user_uid_argument.yml diff --git a/core/modules/user/tests/user_test_views/test_views/views.view.test_view_argument_validate_user.yml b/core/modules/views/tests/views_test_config/test_views/views.view.test_view_argument_validate_user.yml similarity index 100% rename from core/modules/user/tests/user_test_views/test_views/views.view.test_view_argument_validate_user.yml rename to core/modules/views/tests/views_test_config/test_views/views.view.test_view_argument_validate_user.yml diff --git a/core/modules/field/tests/modules/field_test_views/test_views/views.view.test_view_fieldapi.yml b/core/modules/views/tests/views_test_config/test_views/views.view.test_view_fieldapi.yml similarity index 100% rename from core/modules/field/tests/modules/field_test_views/test_views/views.view.test_view_fieldapi.yml rename to core/modules/views/tests/views_test_config/test_views/views.view.test_view_fieldapi.yml diff --git a/core/modules/user/tests/user_test_views/test_views/views.view.test_views_handler_field_user_name.yml b/core/modules/views/tests/views_test_config/test_views/views.view.test_views_handler_field_user_name.yml similarity index 100% rename from core/modules/user/tests/user_test_views/test_views/views.view.test_views_handler_field_user_name.yml rename to core/modules/views/tests/views_test_config/test_views/views.view.test_views_handler_field_user_name.yml diff --git a/core/modules/views/views.theme.inc b/core/modules/views/theme/theme.inc similarity index 100% rename from core/modules/views/views.theme.inc rename to core/modules/views/theme/theme.inc diff --git a/core/modules/views/templates/views-exposed-form.tpl.php b/core/modules/views/theme/views-exposed-form.tpl.php similarity index 100% rename from core/modules/views/templates/views-exposed-form.tpl.php rename to core/modules/views/theme/views-exposed-form.tpl.php diff --git a/core/modules/views/templates/views-more.tpl.php b/core/modules/views/theme/views-more.tpl.php similarity index 100% rename from core/modules/views/templates/views-more.tpl.php rename to core/modules/views/theme/views-more.tpl.php diff --git a/core/modules/views/templates/views-view-field.tpl.php b/core/modules/views/theme/views-view-field.tpl.php similarity index 100% rename from core/modules/views/templates/views-view-field.tpl.php rename to core/modules/views/theme/views-view-field.tpl.php diff --git a/core/modules/views/templates/views-view-fields.tpl.php b/core/modules/views/theme/views-view-fields.tpl.php similarity index 100% rename from core/modules/views/templates/views-view-fields.tpl.php rename to core/modules/views/theme/views-view-fields.tpl.php diff --git a/core/modules/views/templates/views-view-grid.tpl.php b/core/modules/views/theme/views-view-grid.tpl.php similarity index 100% rename from core/modules/views/templates/views-view-grid.tpl.php rename to core/modules/views/theme/views-view-grid.tpl.php diff --git a/core/modules/views/templates/views-view-grouping.tpl.php b/core/modules/views/theme/views-view-grouping.tpl.php similarity index 100% rename from core/modules/views/templates/views-view-grouping.tpl.php rename to core/modules/views/theme/views-view-grouping.tpl.php diff --git a/core/modules/views/templates/views-view-list.tpl.php b/core/modules/views/theme/views-view-list.tpl.php similarity index 100% rename from core/modules/views/templates/views-view-list.tpl.php rename to core/modules/views/theme/views-view-list.tpl.php diff --git a/core/modules/comment/templates/views-view-row-comment.tpl.php b/core/modules/views/theme/views-view-row-comment.tpl.php similarity index 100% rename from core/modules/comment/templates/views-view-row-comment.tpl.php rename to core/modules/views/theme/views-view-row-comment.tpl.php diff --git a/core/modules/views/templates/views-view-row-rss.tpl.php b/core/modules/views/theme/views-view-row-rss.tpl.php similarity index 100% rename from core/modules/views/templates/views-view-row-rss.tpl.php rename to core/modules/views/theme/views-view-row-rss.tpl.php diff --git a/core/modules/views/templates/views-view-rss.tpl.php b/core/modules/views/theme/views-view-rss.tpl.php similarity index 100% rename from core/modules/views/templates/views-view-rss.tpl.php rename to core/modules/views/theme/views-view-rss.tpl.php diff --git a/core/modules/views/templates/views-view-summary-unformatted.tpl.php b/core/modules/views/theme/views-view-summary-unformatted.tpl.php similarity index 100% rename from core/modules/views/templates/views-view-summary-unformatted.tpl.php rename to core/modules/views/theme/views-view-summary-unformatted.tpl.php diff --git a/core/modules/views/templates/views-view-summary.tpl.php b/core/modules/views/theme/views-view-summary.tpl.php similarity index 100% rename from core/modules/views/templates/views-view-summary.tpl.php rename to core/modules/views/theme/views-view-summary.tpl.php diff --git a/core/modules/views/templates/views-view-table.tpl.php b/core/modules/views/theme/views-view-table.tpl.php similarity index 100% rename from core/modules/views/templates/views-view-table.tpl.php rename to core/modules/views/theme/views-view-table.tpl.php diff --git a/core/modules/views/templates/views-view-unformatted.tpl.php b/core/modules/views/theme/views-view-unformatted.tpl.php similarity index 100% rename from core/modules/views/templates/views-view-unformatted.tpl.php rename to core/modules/views/theme/views-view-unformatted.tpl.php diff --git a/core/modules/views/templates/views-view.tpl.php b/core/modules/views/theme/views-view.tpl.php similarity index 100% rename from core/modules/views/templates/views-view.tpl.php rename to core/modules/views/theme/views-view.tpl.php diff --git a/core/modules/views/views.module b/core/modules/views/views.module index e2d5931..f1286d1 100644 --- a/core/modules/views/views.module +++ b/core/modules/views/views.module @@ -95,11 +95,13 @@ function views_config_import_create($name, $new_config, $old_config) { * Implement hook_theme(). Register views theming functions. */ function views_theme($existing, $type, $theme, $path) { - module_load_include('inc', 'views', 'views.theme'); + $path = drupal_get_path('module', 'views'); + module_load_include('inc', 'views', 'theme/theme'); // Some quasi clever array merging here. $base = array( - 'file' => 'views.theme.inc', + 'file' => 'theme.inc', + 'path' => $path . '/theme', ); // Our extra version of pager from pager.inc @@ -137,39 +139,42 @@ function views_theme($existing, $type, $theme, $path) { // Register theme functions for all style plugins foreach ($plugins as $type => $info) { foreach ($info as $plugin => $def) { - // Not all plugins have theme functions, and they can also explicitly - // prevent a theme function from being registered automatically. - if (!isset($def['theme']) || empty($def['register_theme'])) { - continue; - } + if (isset($def['theme']) && (!isset($def['register theme']) || !empty($def['register theme']))) { + $hooks[$def['theme']] = array( + 'pattern' => $def['theme'] . '__', + 'file' => $def['theme file'], + 'path' => $def['theme path'], + 'variables' => $variables[$type], + ); - $hooks[$def['theme']] = array( - 'pattern' => $def['theme'] . '__', - 'variables' => $variables[$type], - ); + $include = DRUPAL_ROOT . '/' . $def['theme path'] . '/' . $def['theme file']; + if (file_exists($include)) { + require_once $include; + } - if ($def['module'] == 'views') { - $def['theme_file'] = 'views.theme.inc'; - } - elseif (isset($def['theme_file'])) { - $def['theme_path'] = drupal_get_path('module', $def['module']); + if (!function_exists('theme_' . $def['theme'])) { + $hooks[$def['theme']]['template'] = drupal_clean_css_identifier($def['theme']); + } } + if (isset($def['additional themes'])) { + foreach ($def['additional themes'] as $theme => $theme_type) { + if (empty($theme_type)) { + $theme = $theme_type; + $theme_type = $type; + } - if (isset($def['theme_path'])) { - $hooks[$def['theme']]['path'] = $def['theme_path']; - } - if (isset($def['theme_file'])) { - $hooks[$def['theme']]['file'] = $def['theme_file']; - } - if (isset($def['theme_path']) && isset($def['theme_file'])) { - $include = DRUPAL_ROOT . '/' . $def['theme_path'] . '/' . $def['theme_file']; - if (is_file($include)) { - require_once $include; + $hooks[$theme] = array( + 'pattern' => $theme . '__', + 'file' => $def['theme file'], + 'path' => $def['theme path'], + 'variables' => $variables[$theme_type], + ); + + if (!function_exists('theme_' . $theme)) { + $hooks[$theme]['template'] = drupal_clean_css_identifier($theme); + } } } - if (!function_exists('theme_' . $def['theme'])) { - $hooks[$def['theme']]['template'] = drupal_clean_css_identifier($def['theme']); - } } } @@ -1926,7 +1931,7 @@ function views_exposed_form_cache($views_name, $display_name, $form_output = NUL * Build a list of theme function names for use most everywhere. */ function views_theme_functions($hook, ViewExecutable $view, $display = NULL) { - module_load_include('inc', 'views', 'views.theme'); + module_load_include('inc', 'views', 'theme/theme'); return _views_theme_functions($hook, $view, $display); } diff --git a/core/modules/views/views_ui/lib/Drupal/views_ui/ViewUI.php b/core/modules/views/views_ui/lib/Drupal/views_ui/ViewUI.php index a6503ec..fa8fc58 100644 --- a/core/modules/views/views_ui/lib/Drupal/views_ui/ViewUI.php +++ b/core/modules/views/views_ui/lib/Drupal/views_ui/ViewUI.php @@ -969,13 +969,6 @@ public function enforceIsNew($value = TRUE) { } /** - * Implements \Drupal\Core\Entity\EntityInterface::getExportProperties(). - */ - public function getExportProperties() { - return $this->__call(__FUNCTION__, func_get_args()); - } - - /** * Implements \Drupal\Core\TypedData\TranslatableInterface::getTranslation(). */ public function getTranslation($langcode, $strict = TRUE) { diff --git a/core/modules/views/views_ui/views_ui.theme.inc b/core/modules/views/views_ui/theme/theme.inc similarity index 100% rename from core/modules/views/views_ui/views_ui.theme.inc rename to core/modules/views/views_ui/theme/theme.inc diff --git a/core/modules/views/views_ui/templates/views-ui-display-tab-bucket.tpl.php b/core/modules/views/views_ui/theme/views-ui-display-tab-bucket.tpl.php similarity index 100% rename from core/modules/views/views_ui/templates/views-ui-display-tab-bucket.tpl.php rename to core/modules/views/views_ui/theme/views-ui-display-tab-bucket.tpl.php diff --git a/core/modules/views/views_ui/templates/views-ui-display-tab-setting.tpl.php b/core/modules/views/views_ui/theme/views-ui-display-tab-setting.tpl.php similarity index 100% rename from core/modules/views/views_ui/templates/views-ui-display-tab-setting.tpl.php rename to core/modules/views/views_ui/theme/views-ui-display-tab-setting.tpl.php diff --git a/core/modules/views/views_ui/templates/views-ui-edit-item.tpl.php b/core/modules/views/views_ui/theme/views-ui-edit-item.tpl.php similarity index 100% rename from core/modules/views/views_ui/templates/views-ui-edit-item.tpl.php rename to core/modules/views/views_ui/theme/views-ui-edit-item.tpl.php diff --git a/core/modules/views/views_ui/templates/views-ui-edit-view.tpl.php b/core/modules/views/views_ui/theme/views-ui-edit-view.tpl.php similarity index 100% rename from core/modules/views/views_ui/templates/views-ui-edit-view.tpl.php rename to core/modules/views/views_ui/theme/views-ui-edit-view.tpl.php diff --git a/core/modules/views/views_ui/views_ui.module b/core/modules/views/views_ui/views_ui.module index a7b20c8..74c9e07 100644 --- a/core/modules/views/views_ui/views_ui.module +++ b/core/modules/views/views_ui/views_ui.module @@ -197,45 +197,55 @@ function views_ui_menu() { * Implements hook_theme(). */ function views_ui_theme() { + $path = drupal_get_path('module', 'views_ui'); + return array( // edit a view 'views_ui_display_tab_setting' => array( 'variables' => array('description' => '', 'link' => '', 'settings_links' => array(), 'overridden' => FALSE, 'defaulted' => FALSE, 'description_separator' => TRUE, 'class' => array()), 'template' => 'views-ui-display-tab-setting', - 'file' => 'views_ui.theme.inc', + 'path' => "$path/theme", + 'file' => 'theme.inc', ), 'views_ui_display_tab_bucket' => array( 'render element' => 'element', 'template' => 'views-ui-display-tab-bucket', - 'file' => 'views_ui.theme.inc', + 'path' => "$path/theme", + 'file' => 'theme.inc', ), 'views_ui_edit_item' => array( 'variables' => array('type' => NULL, 'view' => NULL, 'display' => NULL, 'no_fields' => FALSE), 'template' => 'views-ui-edit-item', + 'path' => "$path/theme", ), 'views_ui_rearrange_form' => array( 'render element' => 'form', - 'file' => 'views_ui.theme.inc', + 'path' => "$path/theme", + 'file' => 'theme.inc', ), 'views_ui_rearrange_filter_form' => array( 'render element' => 'form', - 'file' => 'views_ui.theme.inc', + 'path' => "$path/theme", + 'file' => 'theme.inc', ), 'views_ui_expose_filter_form' => array( 'render element' => 'form', - 'file' => 'views_ui.theme.inc', + 'path' => "$path/theme", + 'file' => 'theme.inc', ), // list views 'views_ui_view_info' => array( 'variables' => array('view' => NULL, 'base' => NULL), - 'file' => 'views_ui.theme.inc', + 'path' => "$path/theme", + 'file' => 'theme.inc', ), // Group of filters. 'views_ui_build_group_filter_form' => array( 'render element' => 'form', - 'file' => 'views_ui.theme.inc', + 'path' => "$path/theme", + 'file' => 'theme.inc', ), // tab themes @@ -247,26 +257,30 @@ function views_ui_theme() { ), 'views_ui_reorder_displays_form' => array( 'render element' => 'form', - 'file' => 'views_ui.theme.inc', + 'path' => "$path/theme", + 'file' => 'theme.inc', ), // On behalf of a plugin 'views_ui_style_plugin_table' => array( 'render element' => 'form', - 'file' => 'views_ui.theme.inc', + 'path' => "$path/theme", + 'file' => 'theme.inc', ), // When previewing a view. 'views_ui_view_preview_section' => array( 'variables' => array('view' => NULL, 'section' => NULL, 'content' => NULL, 'links' => ''), - 'file' => 'views_ui.theme.inc', + 'path' => "$path/theme", + 'file' => 'theme.inc', ), // Generic container wrapper, to use instead of theme_container when an id // is not desired. 'views_ui_container' => array( 'render element' => 'element', - 'file' => 'views_ui.theme.inc', + 'path' => "$path/theme", + 'file' => 'theme.inc', ), ); } diff --git a/core/profiles/standard/standard.install b/core/profiles/standard/standard.install index 725874c..b24946e 100644 --- a/core/profiles/standard/standard.install +++ b/core/profiles/standard/standard.install @@ -379,7 +379,14 @@ function standard_install() { // Create user picture field. module_load_install('user'); - user_install_picture_field(); + _user_install_picture_field(); + // Remove 'summary' pseudo-field from compact view mode on the User entity. + $bundle_settings = field_bundle_settings('user', 'user'); + $bundle_settings['extra_fields']['display']['member_for']['compact'] = array( + 'visible' => FALSE, + 'weight' => 10, + ); + field_bundle_settings('user', 'user', $bundle_settings); // Enable default permissions for system roles. $filtered_html_permission = filter_permission_name($filtered_html_format);