Notice

This old forum is now only available for consultation/read. User accounts on this old website are blocked.
Please create a new account on seblod.com and use the new forum http://www.seblod.com/community/forums.
Apologies for this perturbation and thank you for your understanding!
Welcome, Guest
Username Password: Remember me

Hello World Field Plugin
(1 viewing) (1) Guest
  • Page:
  • 1

TOPIC: Hello World Field Plugin

Hello World Field Plugin 3 years, 4 months ago #1

Hello,
I know you are busy guys, and documentation is planned. So, i tried the forum search with little success. Is there something like a Field-plugin tutorial... or a "Hello World" example ?
The topic has been locked.

Re: Hello World Field Plugin 3 years, 4 months ago #2

  • dan1dyoung
  • ( User )
  • OFFLINE
  • Administrator
  • Posts: 978
Hi,

What are you trying to create and i will see what i can do (I have done a few fields to date but not an expert).

Thanks

Dan
If you use jSeblod CCK, please post a rating and a review at the Joomla! Extensions Directory. For any of my jSeblod CCK Packs or tips visit my site D.Y.Solutions

To keep up to date with new videos about Seblod 2.0 subscribe or visit our channel here
The topic has been locked.

Re: Hello World Field Plugin 3 years, 4 months ago #3

  • georgils
  • ( User )
  • OFFLINE
  • Gold Boarder
  • Posts: 177
Hi, pepperstreet

I don't think there is something in the forum yet, but anyway you'll have to start by reading existing code - it's all in /plugins/... Since the most common (and simple) field is the "Text" field type, probably exploring /plugins/cck_field/text would be a very good start. You could try copying the whole directory and modify an existing text field plugin to create your first. I think it's a pretty straightforwad and self-explanatory but you can always search for help here. I would gladly join Dan with this and probably this is how a guide will be born... I am not an expert too but that's what the forum is - to learn together and share

best regards,
Georgi
The topic has been locked.

Re: Hello World Field Plugin 3 years, 4 months ago #4

  • dan1dyoung
  • ( User )
  • OFFLINE
  • Administrator
  • Posts: 978
Hi,

Sorry i finished late tonight so will write something up tomorrow.

Thanks

Dan
If you use jSeblod CCK, please post a rating and a review at the Joomla! Extensions Directory. For any of my jSeblod CCK Packs or tips visit my site D.Y.Solutions

To keep up to date with new videos about Seblod 2.0 subscribe or visit our channel here
The topic has been locked.

Re: Hello World Field Plugin 3 years, 4 months ago #5

Thanks for your suggestions. Actually, I had nothing particular in my mind.
@ geogils
You are right, that was my first thought. But i am also no expert in this kind of technical stuff, and I am thankful for any explanation and how-to in that area. Especially a conceptional guide or a little chart would be helpful... how does a field-plugin and events work... whats possible in general...

(maybe it sounds strange, I always need an inner image or visual structure to understand a technique )
The topic has been locked.

Re: Hello World Field Plugin 3 years, 4 months ago #6

  • georgils
  • ( User )
  • OFFLINE
  • Gold Boarder
  • Posts: 177
To start: in the Joomla context every Seblod field is a plugin. Like any other Joomla plugin, installed by the Extension Manager and managed later on with the Plugin Manager, where you set some general parameters and publish/unpublish it. They all live in the "plugin" directory right under you Joomla root.

One thing worth noting about plugins is that they a grouped logically according to what they do, so you'll see (in Plugin manager) Content-plugin_name or System-plugin_name, and in your file system you'll see this structure implemented as directories and subdirectories. The meaning of this categorization of plugins is the option (for developers) to trigger the execution of a whole group of plugins with one instruction in a certain place in their code. And this is what Joomla plugins are all about - see this guide, it's a good starting point too.

For myself I prefer to think of plugins as little creatures in the Joomla jungle that hide in bushes and listen for something, for some sound, signal. And when they hear it they jump out and act. On the other side they are capable of producing sounds too that will be heard by the other plugins, which will act in their turn.

But with a slight modification to this abstraction, Joomla has a centralized pattern of "speaking out" that every plugin must follow in order to be able to listen and speak: it's another creature called The Dispatcher that is in charge of synchronizing it all. So instead of shouting out loud a plugin is supposed to tell the Dispatcher to spread the word for it. And instead of listening for every possible noise in the jungle every plugin is listening to the Dispatcher only. And when they hear the word they are programmed to listen for - they act. Acting might mean everything in the Joomla context. It might be intercepting and modifying the content that is right about to be displayed. It might be modifying whatever is just about to be saved. It might be calling some function from somewhere - no limit to what you can do. The genius part of this concept is that you can actually "inject" code (functionality) everywhere in Joomla, at every point in time and context. This is the concept of "events" an in Joomla they are usually self-explanatory: onBeforeContentSave, onDisplay, ... (see the above link for a list). These are Joomla "core" events but you can create your own for intercommunication among your own herd (group) of plugins. Your plugin just relays a word to the Dispatcher to say out loud and only the plugins which are programmed to listen for it will react, the others just won't pay any attention. So you can devise your own words (signals) too.

Seblod field plugins are no different.

So by design Seblod introduces the functionality of "fields" to Joomla as plugins. You have to write one, install it and publish it to have it available for use in Seblod. Say you need some specific field type - a field that will get the values of other fields in the same form and compose a string from them. This string you want stored in a specific database table field for later usage. So you write a plugin. Or you just get one and modify it (much easier).

It makes no sense to describe the structure of a Seblod field plugin, you just open an FTP session and explore the many pre-installed ones and get the convention at once.

To cut the story somewhat you could:

  1. open Plugin manager and chose the "Text" plugin
  2. open the Advanced panel and click "download" @ export
  3. you'll get the plugin packed : plg_cck_field_text.zip
  4. save locally, extract to a directory
  5. open each file in it to familiarize yourself
  6. replace all occurrences of "text" with your desired plugin name
  7. zip back and try installing it to Joomla


You should end up with a new field available in Seblod. Don't pay attention to things like PLG_CCK_FIELD_GROUP_FORM, they'll be fixed later. And now the fun part begins. Open for edit (via FTP or exTplorer or whatever) the xxx.php file in the root of the plugin and try adding an echo or something innocent to feel the plugin responding, to feel control Then try modifying the value of the field. Or calling some other plugin. Absolutely necessary I find having the JDump tool at hand - waiting for you @ the JED.

And then - well, come back to share your discoveries or proudly announce the birth of a new Seblod field type and of course place it here for download under GNU GPL!

best regards,
Georgi
The topic has been locked.
The following user(s) said Thank You: pepperstreet, abunning, MatthewSchenker, damendieta

Re: Hello World Field Plugin 3 years, 3 months ago #7

Greetings georgils,
I don't know how I missed your excellent post until now! But better late than never.

You did a terrific job in this specific area of pointing us in the right direction. Your manner of explaining things is valuable. Please use this skill in other areas of Seblod!

Thanks again,
Matthew
Last Edit: 3 years, 3 months ago by MatthewSchenker.
The topic has been locked.

Re: Hello World Field Plugin 3 years, 3 months ago #8

@ georgils
Thanks for your illustrative explanation – i really do love the creature-story!!!
Last Edit: 3 years, 3 months ago by pepperstreet.
The topic has been locked.
  • Page:
  • 1
Time to create page: 0.21 seconds