This site has been archived and you can no longer log in or post new messages. For up-to-date community resources please visit ezplatform.com

eZ Community » Forums » Developer » Object relation browser in a custom...
expandshrink

Object relation browser in a custom module

Object relation browser in a custom module

Thursday 08 December 2011 11:48:33 am - 7 replies

Hey, I want to use a object relation browser in a custom module to create objects in php with relations. My standard text fields post are working correctly, but I don't know how to handle this with the relation browser.

In other words, I want to use this 

 {include uri='design:content/datatype/edit/ezobjectrelationlist.tpl'}

and need to know what I need to get this working in my custom module.

Found the correct words I think blunk.gif Emoticon I need the /content/browse functionality in my module :] How can I do it?

Modified on Thursday 08 December 2011 10:56:36 pm by scrieler _

Friday 09 December 2011 6:20:30 am

Hello Scrieler,

 

You sounded a bit frantic today.

Sorry it took me so long to reply tonight.

And we are sorry we were not able to talk as much
in #ezpublish as much as we had inteneded.

We did have some ideas but we were very busy today
and with #ezpublish going so slow, we mearly lost track of time.

Still, I'm taking a moment to share some thoughts now,
in the hope they might help. (We pick up each others slack in a way)

 

Ok now I have to break for a moment to say, you really, really would help us all out a lot more if you provided like a good two paragraph detailed, clear, description of what your really trying to achieve, what your goal is, your specific requirements, and so on, so we can really understand the context in which your trying to develop your solution within. I mean at this point I realize I have so many unanswered questions I don't really even know where best to begin ...

I think you are talking about two different types of functionality as though they are one. First the content/browse module view which allows you to submit a post request to the view, select a node, perform a related action (I think, Re: http://serwatka.net/blog/do_you_need_action ) and return the user back to the original page. Second the ezobjectrelationlist datatype which is separate from the content/browse functionality.

  • Note: I would prolly have to discourage / not recommend 're-building chunks of the content module functionality in other modules' in general as a warning. If you can reuse key default parts, great, if not, it may be best to build your own solutions.

I say this because it really, really sounds like your trying to first re-create in at least part content/edit module view (or else you would be using it, for one, and not talking about things like .. including datatype specific edit view templates directly (omg, I still can't believe that was your snippet, and that will never work (very well/by default)).

I think this *could potentially* be a really bad idea to support :\ mostly because your version will prolly look nothing like the original (nor will it function internally the same/as good). I've seen a few folks do this in the past and the results were almost always very poor (in many many aspects).

 

  • Q: Why are you not using the default content module for your content object placement selection, editing, validation, creation (and a whole lot more functionality out of the box) as intended? If you almost everything you are asking about would just work out of the box.

I'll sidestep for a moment here to point out that if this was in the default content/edit module view templates you would prolly be using an attribute_edit_gui to render the attribute(datatype) specific template code required for the form for you, http://doc.ez.no/eZ-Publish/Technical-manual/4.x/Reference/Template-functions/Visualization/attribute_edit_gui

 

I must say I've never been so brazen even suggest including a datatype template in the way you suggest or crazy to produce a modified version which did work, as it seems like an unwise effort as it seems to go against the natural design of the systems involved.

 

I found an older forum reference of another fellow who was seemingly trying to do similar things as yourself.

 

Ok now for some more questions that just randomly appear, please understand if these are worthless questions, I am running on very little sleep this week :P

 

 

I just think you can make use of the default content/browse feature without having to customize a copy of that functionality directly, though you still do have to do some work for -your- code to properly make use of this system.

 

Use the admin, edit a node with object relations, inspect the form and button html sources to understand how the url redirection process works here, then inspect (use firebug to see during content/browse) the browse list of nodes with checkboxes, this form submits an array of selected ObjectIDs back to return your the form was provided to begin with (calculated / passed in relation_edit.php)

 

Next see how the datatype is responsible for 'catching' the http post variable 'SelectedObjectIDArray' for processing and storage which is sent back to the content/edit module view from content/browse from. You can use this behavior as well, though you will have to replicate functionality provided by the default content module and supporting classes in some respects within -your- custom module view be able to use this behavior.

 

You can reuse this code directly I believe (untested thought), in your module view (though uncertain at what level atm ( include vs modified copy ..)

Though I might recommend instead creating your edit view off a copy of the default view and modify that to meet your needs instead of the other way around. In this way you don't have to manually add so much default content/edit php view code into your module, over and over again until you 'think' you got enough for it all to work (which I think takes more time than the alternative) 

  • In any case I hope this helps show others how the default content module view works in a new way. It can be scary at times, complicated others, but it is mearly PHP code not a demon.

 

My point being that you should be using these systems (or modified copies) to perform your task and reach your goals. It just takes a bit of grep use, google, api docs and github to read sources in a more friendly way ... Though it does take time. I won't even bother you with how much time I took tonight to write this post. I should be sleeping over 3 hours ago :P

If you could / did use it, you would avoid re-creating a lot of supporting code, right away, from your solution.

 

The above also can help provide an example of how the various default template(s) that are used here as well as a reference in the code you may want in your own module view templates (if you use them)  which might help you directly in presenting the various ui's like html form template, content, etc in your custom module view / use of content/browse in your module view.

 

Apologies for the length of my reply. I lost track of time ...

 

I hope this helps

Best wishes

 

Cheers,

Heath

 

 

These articles are also good reads for custom module view developers,

Saturday 10 December 2011 12:13:42 am

hmm, I hoped to get an answer with this info

eZContentBrowse::browse
eZContentBrowse::result

and how to configurate it to get the result to my module... and maybe one, two nice examples

 

it's extremly hard to understand all the text u're writing for me, u should know that blunk.gif Emoticon

thanks for your time =)

Modified on Saturday 10 December 2011 12:18:04 am by scrieler _

Saturday 10 December 2011 12:46:07 am

Yeah it's more complicated that a single snippet of a php static class method ... you should know that scrieler.

I'm starting to think your not investing nearly enough time into the study, learning and testing of how the kernel operates internally.

I took the time two write out exactly how to debug, follow along the code execution in the kernel code and use the features you claim you want to re-use, I read the code and pointed out all the key parts of the kernel which perform all the tasks you asked about with specific examples provided (which do work by default so ... what's the problem in understanding them?)

 

Also you didn't answer any of my previous questions or respond to any of the insights I shared, why not? :\

 

Please don't ignore what I wrote, if you do not understand, then please ask me questions, work with me to help you -learn- what is required here.

Let me know how this helps you. Let me know if the above helps you see what you need to do similar in your own module view to reach your goals.

 

I know this can be done but I have no idea what exactly you don't understand or even where to begin to re-explain it to you more clearly ... mostly cause you say so very little, in your replies.

 

Good luck

 

Cheers,

Heath

Modified on Sunday 11 December 2011 1:55:24 am by // Heath

Saturday 10 December 2011 2:56:54 am

what are u writing? kid? not understanding ez? did u slept not enough?

I say all I am looking for was

eZContentBrowse::browse

my module redirects correctly to the content browse module and redirects back to my module...

I don't want to get a dictionary if I only looking for a simple word/tip.

Don't know why u're writing like I was a idiot... gn8

Sunday 11 December 2011 1:50:01 am

Hello scrieler,

 

I noticed today that the extension BCLoremIpsum provides a module view which uses the content/browse functionality. Perhaps you can use it as an example in your own module view.

 

https://github.com/brookinsconsulting/bcloremipsum/blob/master/modules/bcloremipsum/create.php#L162

 

 

Cheers,

Heath

Sunday 11 December 2011 4:52:04 pm

Hello scrieler,

 

I got to help test a cool new feature of BC Image Alias extension for eZ Publish which uses eZContentBrowse::browse feature of eZ Publish!

Today we have pushed a rather large set of improvements to GitHub,

https://github.com/brookinsconsulting/bcimagealias/commit/140ac3f8b5154973b744bf8e18386ccc3502d96c

https://github.com/brookinsconsulting/bcimagealias

 

You can review the changelog (as we have made many improvements to 0.0.23 version)
https://github.com/brookinsconsulting/bcimagealias/blob/master/doc/changelogs/CHANGELOG-0.0.23

 

If you install, configure and use the admin module view 'create' or 'remove' which provide use for the eZContentBrowse::browse feature of eZ Publish. Here is the code which powers the feature in the extension module views.

https://github.com/brookinsconsulting/bcimagealias/blob/master/modules/bcimagealias/create.php#L140

https://github.com/brookinsconsulting/bcimagealias/blob/master/modules/bcimagealias/create.php#L198

https://github.com/brookinsconsulting/bcimagealias/blob/master/modules/bcimagealias/create.php#L205

https://github.com/brookinsconsulting/bcimagealias/blob/master/modules/bcimagealias/remove.php#L128

https://github.com/brookinsconsulting/bcimagealias/blob/master/modules/bcimagealias/remove.php#L186

https://github.com/brookinsconsulting/bcimagealias/blob/master/modules/bcimagealias/remove.php#L193

The bcimagealias extension module views use of eZContentBrowse::browse feature requires the following settings,

https://github.com/brookinsconsulting/bcimagealias/blob/master/settings/browse.ini.append.php#L3

 

To use the feature simply call either of the module views specifying the NodeID parameter as false.

Which is a really cool idea if you think about it. Wouldn't it be cool if more module view's allowed you to pass a module view parameter value of false to simply display a node selection form using eZContentBrowse::browse which then performed an action using / based on the NodeID (selection, more than one are supported!) parameter returned by eZContentBrowse::browse to the module view used. No more need to 'lookup' a NodeID before using BCImageAlias module views, just select the Nodes you want to process and submit happy.gif Emoticon

 

You can see all the supported usage examples of how to use these module views by reviewing the doc/USAGE file,

https://github.com/brookinsconsulting/bcimagealias/blob/master/doc/USAGE

Here is the brief usage example syntax:

http://(host)/(index)/(siteaccess)/bcimagealias/create/(NodeID)/(Children)/(Regenerate)/(CurrentSiteaccess)
http://(host)/(index)/(siteaccess)/bcimagealias/remove/(NodeID)/(Children)/(Regenerate)/(CurrentSiteaccess)

Here are just a few of the supported usage examples available:

http://localhost/index.php/ezwebin_site_admin/bcimagealias/create/false
http://localhost/index.php/ezwebin_site_admin/bcimagealias/create/false/true/false/true
http://localhost/index.php/ezwebin_site_admin/bcimagealias/create/190/true/true/false
http://localhost/index.php/ezwebin_site_admin/bcimagealias/remove/false
http://localhost/index.php/ezwebin_site_admin/bcimagealias/remove/false/true/false/true
http://localhost/index.php/ezwebin_site_admin/bcimagealias/remove/190/true/true/false

 

These features were pushed today to GitHub, we have not yet refreshed the projects.ez.no project download packages just yet, so be certain to test the latest version using the GitHub sources.

 

We hope this helps ...

 

Cheers,

Heath

Modified on Sunday 11 December 2011 4:58:04 pm by // Heath

Monday 12 December 2011 8:45:56 pm

hmm, had already solved the problem, have forgotten to mark the thread... thanks anyway

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from