1

I created a plugin for IP 3.9 to upload videos to encoding.com and convert them to mp4 so users would not have to worry about the format of the videos to use in their html5 sites.

In the previous version of ImpressPages I used the element_file of the ItemsArea class to upload the original videos to a temp folder, once the video was encoded I would put it in the Repository so it is available to the users for embedding using a widget.

In the new Impress Pages 4 Grid class the element_file was replaced for the RepostoryFile field and it directly uploads the file to the main Repository (does not let you choose the destination), which makes the non-encoded video to be available to the user.

Is there a way to override this behaviour without modifying the core files?

or is there a way to tell the repository not to show this files until they are encoded (like a visibility flag)?

or can I create a custom field type from a plugin?

jeruki
  • 1,860
  • 3
  • 20
  • 27

1 Answers1

0

You can create custom field type for your plugin. Just use Full class name including namespace in Grid configuration.

File input which save files to tmp folder would be useful for others. So you can contribute it to the core too.

Mangirdas Skripka
  • 1,647
  • 1
  • 15
  • 14
  • I actually kinda fixed it, I duplicated the code in Ip\Internal\Grid\Model\Field\RepositoryFile and put it into File.php in the same location, changed the class name to File and in the create method declared $field = new \Ip\Form\Field\File(...) instead of \Ip\Form\Field\RepositoryFile. Doing this saved the file to file/secure/tmp instead, I just had to remove the file limit related code. Is this the correct location to save it? – jeruki May 02 '14 at 20:42
  • Sound very good. Has to be perfect. waiting for pull request on GitHUB – Mangirdas Skripka May 02 '14 at 21:14
  • It worked fine to upload the file, but the interface part of the form is a little problematic, the File Form field does not have an edit view, so when I use it in the Grid and click edit, I only get the upload button and no other sign that there is a file already uploaded, I tried to copy the view code of repositoryFile.php to Ip/Form/Field/adminView/file.php and that makes the name of the existing file appear under the button but the 'x' next to it does not remove the file, also validation gives some trouble. What else could I modify to make it work,lets say pass an array of valid extensions? – jeruki May 02 '14 at 21:59
  • That probably means that Ip\Form\Field\File is not ready for editing. It is not working not because you have done something wrong, but likely because it is not implemented itself. – Mangirdas Skripka May 04 '14 at 17:20
  • I see in that case I will have to add that functionality then I guess. – jeruki May 05 '14 at 15:48
  • Yes because my hands are on ecommerce solution. – Mangirdas Skripka May 05 '14 at 17:29