TOPIC:

how to hand over record_id to plugin 4 years 11 months ago #183650

  • Topic Author
  • hartmuts1
  • Offline
  • Fresh Breezer
  • Fresh Breezer
  • Posts: 9
  • Thanks: 0
I wrote my own verification plugin (contentbuilder - verify - flightlogcommit) and call it in the record details by {CBVerify plugin: flightlogcommit; verification-name: Flightlog_Commit ; verify-view:13; item: {id:value};}. Everything works fine, but unfortunately the term "{id:value}" is not converted to the record_id of the current details record as expected, instead the term itself is put in the plugin option list. It works fine with any other of the visible fields in details record.
So, here is my question: How can I refer to the primary key of a record I'd like to verify by plugin in "CBVerify syntax" or is there any other way how to get access to the record_id from within the plugin? I need the id because I'd like to read the details from db from inside of the plugin instead of putting all the fields on the options list.

Please Log in or Create an account to join the conversation.

Last edit: Post by hartmuts1.

eigenes "Verify" plugin aufrufen 4 years 11 months ago #183985

  • Tihomir's Avatar
  • Tihomir
  • Offline
  • User is blocked
  • User is blocked
  • Posts: 3564
  • Karma: 87
  • Thanks: 288
Hello there,

Since we don't have much native german speakers here on the forum, could you please post your request on eng so we can continue. Otherwise you will have to wait for an answer a while longer.

Kind regards
Tihomir
===============================================
Support Crosstec and get ALL EXTENSIONS and professional support for just $5
Here!
===============================================
Regards
Tihomir
==========================================
+++ Purchase Professional Support: crosstec.org/en/support/purchase-additional-support.html +++

Please Log in or Create an account to join the conversation.

Last edit: Post by Tihomir.

how to hand over record_id to plugin 4 years 11 months ago #184052

  • Topic Author
  • hartmuts1
  • Offline
  • Fresh Breezer
  • Fresh Breezer
  • Posts: 9
  • Thanks: 0
Ok, I found a solution that works for me, but actually its a dirty hack. so dont use in general. It mention it here just to ilustrate my issue.

This is the conept:
On content template, use a placeholder string for the record id and replace it by the actual record_id when reading the template data model.

This is the placeholer: {CBVerify ...; item:{record_id:value};}

This is the hack:
in class contentbuilder, getTemplate((), right after \htdocs\administrator\components\com_contentbuilder\classes\contentbuilder.php line 1163, insert
$template = str_replace('{record_id:value}',$record_id, $template);

The root cause, for my opinion, seams to be the fact that the record id is not considered as a field when generating the datasource from an existing table, and though cannot be setup as member of the items list in the details. In the moment when record_id would appear in the details field list, it could be refered in {cbVerify ...} as well and processed as any other field.

Is there any better solution I missed?

Please Log in or Create an account to join the conversation.

how to hand over record_id to plugin 4 years 11 months ago #184054

  • Topic Author
  • hartmuts1
  • Offline
  • Fresh Breezer
  • Fresh Breezer
  • Posts: 9
  • Thanks: 0
ContentBuilder is a cool product, but let me say one word to the online help or documentation I found on the web. Well, after some nights I've spent for code reading and debugging the package, I can say I begin to understand what you try to say in your "online documentation" and samples. Guess it should be the other way, actually. Especially CB is thought as a tool for getting a prototype solution rapidly, without the need to spend the time for programming comlete components. So time matters. Please give me, or your users, a favor and put some more detailed explanation about the underlying concepts and its usage tothe web. For instance, how datasources, list-, detail- and edit-views work together, how plugins are to be called and how a verify plugin interact with a paypal or passthrough plugin, how users can write and install their own plugins, etc.

Please Log in or Create an account to join the conversation.

how to hand over record_id to plugin 4 years 11 months ago #184133

  • TheMuffinMan's Avatar
  • TheMuffinMan
  • Offline
  • Developer
  • Developer
  • Posts: 10064
  • Karma: 167
  • Thanks: 808
Hi,

we are currently trying to bring updates forward (not just ContentBuilder) but since we're a small company, things unfortunately take time. But we addressed our slowness and with the upcoming ContentBuilder update, there will also be a better documentation, promise.

However, the above thing with Record ID, can be handled without hacking in the Content Prepare tab of the view setup as it allows to override field values (and labels) using PHP:
$items[FIELDNAME]['value'] = $record_id; // $record_is is available in this context

Where FIELDNAME is the name of the field, not title and that field can be any field you want to override. If you simply need a field to display this value, either create another field in the datastorage or in breezingforms if you use it (for example a hidden input).

Is that what you initially were looking for?

Regards,
Markus

Please Log in or Create an account to join the conversation.

how to hand over record_id to plugin 4 years 11 months ago #184303

  • Topic Author
  • hartmuts1
  • Offline
  • Fresh Breezer
  • Fresh Breezer
  • Posts: 9
  • Thanks: 0
adding an extra field (record_id) besides primarykey (id) in the datastorge would work and is for sure the better solution compared to my hack. In my case the coriginal data are received by REST-Api from another process, so I could fill the record_id with new id right at the moment when creating the record in my api implementation. Overwriteing by using a replace term in ContentPrepare would not be neccessary. Backside of this solution ist that it mix up my original data model with implementation specific fields, but anyhow, I'll do it this way and report if it really works at this place.

But just for my understanding. Why is id excluded at all from the generated list of fields when creating the datastorage from an existing table? Ok. I understand that primary keys must not be object of change actions, but wouldnt it be better to allow primary keys in the field list, perhaps as as an option, and protect them from being used in change actions afterwards?

Please Log in or Create an account to join the conversation.

Last edit: Post by hartmuts1.
  • Page:
  • 1
  • 2
Time to create page: 0.051 seconds

BreezingForms Pro 1.4.7 for WordPress Released!

Available in the membership section.

September Discount!

Massive discounts on all subscriptions!

Get Your Subscription Here

Quick Links

Downloads

BreezingForms

ContentBuilder

BreezingCommerce

Templates

Documentation

BreezingForms

ContentBuilder

BreezingCommerce

Apprendre BreezingForms (French Community)

Apprendre et maîtriser BreezingForms par des tutoriels et exemples, le tout en français

breezingforms.eddy-vh.com

Questions et réponses sur les forums de l'AFUJ

AFUJ

Special Offer

Summer Sale! All subscriptions at a special price!

Includes prio support, all of our current and future Joomla!® extensions and Joomla!® templates for the duration of your membership.

Get it from here

3rd Party Discount - 25% Off

We help you to keep your costs under control. If you are a new member and purchased a form building tool from a different form vendor, then you'll get a 25% discount on our subscription plans.

How to receive the discount:

Send us a quick email to sales@crosstec.org with a proof of purchase (for example a paypal receipt), await payment instructions and enjoy your membership!