Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add File Entity On Upload Success #13

Open
alexfinnarn opened this issue Dec 5, 2018 · 0 comments
Open

Add File Entity On Upload Success #13

alexfinnarn opened this issue Dec 5, 2018 · 0 comments

Comments

@alexfinnarn
Copy link
Owner

alexfinnarn commented Dec 5, 2018

Now that the image tag inserts correctly, the second part is adding a file entry to "admin/content/files". This happens on the DrupalImage plugin when the user "saves" the image closing the dialog.

One funny thing to note is that if I decide to remove the image before I save the node, the file still exists in Drupal. Also to note, if I remove the image from the node via the WYSIWYG editor, the "useage" part of the file table still says that it is being used on the node I deleted it from. So, there are a couple of bugs to deal with there...I should submit those when I have time...

I don't think adding a file entity happens in the plugin JS but rather somewhere else in the CKEditor module code. It might be easiest to just make an AJAX call back to Drupal however you create an entity that way.

https://api.drupal.org/api/drupal/core%21modules%21file%21file.module/function/file_save_data/8.6.x

That is how you could save a file, but since we aren't actually storing a file that doesn't make sense.

The View at "admin/structure/views/view/files" is where the list is generated...so if a Filestack entity could be created and merged into the files view, then all the parts of the table can be shown.

{
  "filename": "Screen Shot 2018-12-03 at 9.38.41 AM.png",
  "handle": "nkN0uGuJQpGjYKeHrAPg",
  "mimetype": "image/png",
  "originalPath": "Screen Shot 2018-12-03 at 9.38.41 AM.png",
  "size": 200726,
  "source": "local_file_system",
  "status": "Stored",
  "uploadId": "5a1266c2d4c25839cb3b9dd9ab4640c6",
  "url": "https://cdn.filestackcontent.com/nkN0uGuJQpGjYKeHrAPg",
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant