Skip to content

SS6.1.10: error in FileAdmin #126

Description

@wernerkrauss

Hi @jonom, in SS6.1.10 I get the following error when clicking on a file in file Admin:

ERROR [Emergency]: Uncaught Error: Call to a member function getX() on null
IN GET /admin/assets/schema/fileEditForm/3
Line 85 in /var/www/html/vendor/jonom/focuspoint/src/Forms/FocusPointField.php

Source
======
  76:              $w = intval($this->config()->get('max_width'));
  77:              $h = intval($this->config()->get('max_height'));
  78:              $previewImage = $this->image->FitMax($w * 2, $h * 2);
  79:  
  80:              if ($previewImage) {
  81:                  $state['data'] += [
  82:                      'previewUrl' => $previewImage->getURL(),
  83:                      'previewWidth' => $previewImage->getWidth(),
  84:                      'previewHeight' => $previewImage->getHeight(),
* 85:                      'X' => $this->image->getField($this->getName())->getX(),
  86:                      'Y' => $this->image->getField($this->getName())->getY()
  87:                  ];
  88:              }
  89:          }
  90:  
  91:          return $state;

This is, cause the name of the field is not set properly. I debugged it and it gets lost in a parent class; Then getName() returns the title (wich is "Focus point") with stripped space; Then the image doesn't find the correct field...

A possible fix is to change the last two lines in FocusPointField::__construct()... first call parent::__construct(), then set the name again.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions