Commit aee1ba5d authored by Nathaniel's avatar Nathaniel
Browse files

Issue #3289079 by Nathaniel: Update tests, code cleanup and deprecated functions.

parent 313cbf6b
Loading
Loading
Loading
Loading
+1 −1
Changes for photos.info.yml: 1 added line, 1 removed line.
Original line number Diff line number Diff line
name: 'Photos'
description: 'Picture management module. Photo albums.'
type: module
core_version_requirement: ^8.8 || ^9
core_version_requirement: ^8.8 || ^9 || ^10
package: 'photos'
configure: photos.admin
dependencies:
+3 −3
Changes for photos.install: 3 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -327,7 +327,7 @@ function photos_update_8502(&$sandbox) {
    $all_created = TRUE;
    // Only create if the photos view doesn't exist and views is enabled.
    if (!View::load('photos')) {
      $config_path = drupal_get_path('module', 'photos') . '/config/optional/views.view.photos.yml';
      $config_path = \Drupal::service('extension.list.module')->getPath('photos') . '/config/optional/views.view.photos.yml';
      $data = Yaml::parseFile($config_path);
      \Drupal::configFactory()->getEditable('views.view.photos')->setData($data)->save(TRUE);
    }
@@ -336,7 +336,7 @@ function photos_update_8502(&$sandbox) {
    }
    // Album view.
    if (!View::load('photos_album')) {
      $config_path = drupal_get_path('module', 'photos') . '/config/optional/views.view.photos_album.yml';
      $config_path = \Drupal::service('extension.list.module')->getPath('photos') . '/config/optional/views.view.photos_album.yml';
      $data = Yaml::parseFile($config_path);
      \Drupal::configFactory()->getEditable('views.view.photos_album')->setData($data)->save(TRUE);
    }
@@ -345,7 +345,7 @@ function photos_update_8502(&$sandbox) {
    }
    // Album list view.
    if (!View::load('photos_album_list')) {
      $config_path = drupal_get_path('module', 'photos') . '/config/optional/views.view.photos_album_list.yml';
      $config_path = \Drupal::service('extension.list.module')->getPath('photos') . '/config/optional/views.view.photos_album_list.yml';
      $data = Yaml::parseFile($config_path);
      \Drupal::configFactory()->getEditable('views.view.photos_album_list')->setData($data)->save(TRUE);
    }
+8 −3
Changes for photos.module: 8 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -514,7 +514,12 @@ function photos_node_view(array &$build, EntityInterface $node, EntityViewDispla
              $views_display = $view->storage->getDisplay($view_display_id);
              if (isset($views_display['display_options']['arguments'])) {
                $arguments = $views_display['display_options']['arguments'];
                $args = ['view' => $views_view, 'display' => $view_display_id];
                // The view.
                $args = [
                  'name' => $views_view,
                  'display_id' => $view_display_id,
                ];
                // Arguments for contextual filters.
                foreach ($arguments as $key => $arg) {
                  if ($key == 'uid') {
                    $args['user'] = $node->getOwnerId();
@@ -523,7 +528,7 @@ function photos_node_view(array &$build, EntityInterface $node, EntityViewDispla
                    $args['node'] = $node->id();
                  }
                }
                $photos = call_user_func_array('views_embed_view', $args);
                $photos = call_user_func_array('views_embed_view', array_values($args));
              }
              else {
                $photos = views_embed_view($views_view, $view_display_id, $node->id());
@@ -967,7 +972,7 @@ function photos_preprocess_photos_image_html(&$variables, $hook) {
      if (!file_exists($styleUri)) {
        $style->createDerivative($uri, $styleUri);
      }
      $url = file_create_url($styleUri);
      $url = \Drupal::service('file_url_generator')->generateAbsoluteString($styleUri);
    }

    // Render image view.
+7 −0
Changes for photos.post_update.php: 7 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -174,3 +174,10 @@ function photos_post_update_migrate_photos_image_entity_2(&$sandbox = NULL) {
function photos_post_update_new_photos_upload_container_parameter_token() {
  // Empty update to cause a cache rebuild so that the container is rebuilt.
}

/**
 * Rebuild photos upload container to add new container parameter.
 */
function photos_post_update_new_photos_upload_container_parameter_file_repositor() {
  // Empty update to cause a cache rebuild so that the container is rebuilt.
}
+1 −1
Changes for photos.services.yml: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -6,4 +6,4 @@ services:
      - { name: event_subscriber }
  photos.upload:
    class: Drupal\photos\PhotosUpload
    arguments: ['@config.factory', '@database', '@current_user', '@entity_field.manager', '@entity_type.manager', '@file_system', '@file.usage', '@image.factory', '@messenger', '@module_handler', '@stream_wrapper_manager', '@token', '@transliteration']
    arguments: ['@config.factory', '@database', '@current_user', '@entity_field.manager', '@entity_type.manager', '@file.repository', '@file_system', '@file.usage', '@image.factory', '@messenger', '@module_handler', '@stream_wrapper_manager', '@token', '@transliteration']
Loading