The Sorting feature doesn't work right now, since the save function contains a typo.
The Error is found at line 277 in PhotosRearrangeController.php.
The function condition() is called wrong: condtion('pid', $nid)

public function editSortSave($order = [], $nid = 0, $type = 'images') {
    if ($nid) {
      $access = FALSE;
      if ($nid) {
        $node = \Drupal::entityManager()->getStorage('node')->load($nid);
        // Check for node_accss.
        $access = _photos_access('editAlbum', $node);
      }
      if ($access) {
        $weight = 0;
        // Update weight for all images in array / album.
        $db = \Drupal::database();
        foreach ($order as $image_id) {
          $fid = str_replace('photos_', '', $image_id);
          if ($type == 'images') {
            // Save sort order for images in album.
            $db->update('photos_image')
              ->fields([
                'wid' => $weight,
              ])
              ->condition('fid', $fid)
              ->condtion('pid', $nid)
              ->execute();
          }
          $weight++;
        }
        if ($weight > 0) {
          $message = t('Image order saved!');
          return $message;
        }
      }
    }
  }

After fixing the typo, the save will work again.

Comments

Ahadoron created an issue. See original summary.

  • Nathaniel committed ae39101 on 8.x-4.x authored by Ahadoron
    Issue #2929692 by Ahadoron: Typo in PhotosRearrangeController.php.
    
nathaniel’s picture

Status: Active » Fixed

Thanks for the bug report!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.