By Vladimir Antropov on Sunday, 27 July 2014
Replies 11
Likes 0
Views 0.9K
Votes 0
Hello,

I have created an app which allows to populate, store and display custom fields in a stream item. How can I add a custom edit form which will be displayed when a user selects "Edit this item" command?

I've checked the code and found that the response to that command is hard-coded in "{editStream} click" event handler in media/com_easysocial/scripts/site/stream/item.js. Is it possible to override that handler for my stream item type without changing ES code?

Regards,
Vladimir
Hello Vladimir,

I am sorry but unfortunately right now, "editing" of stream items are only available to standard post types We are still figuring out for a proper way to edit rich media contents on a posted stream (Even facebook is struggling with this I believe )
·
Sunday, 27 July 2014 23:11
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi Mark,

Thank you for the quick response (looking at its timestamp, I wonder if you have any social life except EasySocial ).

So you don't have a framework for custom edit forms now. I am going to write an editor for my stream item anyway, but I'd like to minimise changes to the ES code. Ideally, it would be a one-line change which is easy to restore after upgrades. Can you recommend a good way to plug my editor into ES, on both client and server sides?
·
Monday, 28 July 2014 19:35
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Vladimir,

We don't actually have any "triggers" for this yet unfortunately as we haven't really figured out the best way to do this.
·
Monday, 28 July 2014 19:56
·
0 Likes
·
0 Votes
·
0 Comments
·
I'd like to replace the default editor loaded by EasySocialViewStream.edit(). I am not familiar with the naming conventions used by ES, so I am just guessing that it is loaded by this code
EasySocial.ajax('site/views/stream/edit',
{
"id" : id
})

in \media\com_easysocial\scripts\site\stream\item.js. Can you please confirm this, and explain or refer me to a document which describes how paths like 'site/views/stream/edit' are translated to the actual file path?

Also, instead of modifying EasySocialViewStream I want to create a child class which will override just edit() function. How can I do it? Should I create a new file and change the path in EasySocial.ajax()? Or can I add the child class to the same file?
·
Sunday, 17 August 2014 20:04
·
0 Likes
·
0 Votes
·
0 Comments
·
This is actually a namespace that can be broken down to the following,

site/views/stream/edit -> /components/com_easysocial/views/stream/view.ajax.php @edit method

There's no way to override a view file currently unfortunately.
·
Sunday, 17 August 2014 21:58
·
0 Likes
·
0 Votes
·
0 Comments
·
Thank you for confirming this, Mark. However, I still don't understand how this works in general. Is there a documentation about namespaces?
Specifically, I don't understand:
1. Why view.ajax.php file is selected out of several others in the same directory?
2. Why edit() method is called in EasySocialViewStream class? A file can contain other classes so how would ES know which one to instantiate?

Regards,
Vladimir
·
Monday, 18 August 2014 17:18
·
0 Likes
·
0 Votes
·
0 Comments
·
When an ajax call is made to the server, an additional parameter is sent to the server &format=ajax and with this, Joomla will automatically search for view.ajax.php . As to why "edit" is called, please take a look at the namespace again, 'site/views/stream/edit' . It is rendering the edit method of the view stream class.
·
Monday, 18 August 2014 23:09
·
0 Likes
·
0 Votes
·
0 Comments
·
Looking at your reply, Mark, I've realised that my question was ambiguous. What I wanted to ask was not why edit() method is called, but why it is called in that particular class - EasySocialViewStream. The namespace does not mention the class name and there may be multiple classes in the file. How does ES know in which class to search for edit() method?
·
Tuesday, 19 August 2014 21:21
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Vladimir,

What do you mean by why "edit" is called? The namespace already indicates that it is calling the particular class / method :P

The breakdown of the namespace site/views/stream/edit :

site - This basically converts to /components/com_easysocial
views - This basically converts to /components/com_easysocial/views
stream - This converts to /components/com_easysocial/views/stream/view.ajax.php
edit - This indicates the method edit in the view.ajax.php file
·
Wednesday, 20 August 2014 00:05
·
0 Likes
·
0 Votes
·
0 Comments
·
Thank you for the breakdown, Mark. It explains how file is found and what method is called. The missing link for me is the class name inside the file. The method belongs to a class, not to a file, so you need to know the class name in order to call the method. How do you determine the class name?
·
Wednesday, 20 August 2014 18:05
·
0 Likes
·
0 Votes
·
0 Comments
·
This is actually Joomla's standard ExtensionnameViewViewname . It's not an EasySocial thing
·
Wednesday, 20 August 2014 18:16
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post