TOPIC:

CB Content Prepare : How to add calculated fields 6 months 2 weeks ago #257323

  • Topic Author
  • hverdel
  • Offline
  • Junior Breezer
  • Junior Breezer
  • Posts: 41
  • Thanks: 0
Is there a way to add new fields, for display purposes only?

I have tried in the Content Prepare tab of a view:
$statii = array("1" => "Ingediend", "2" => "Bezig", "3" => "Goedgekeurd", "4" => "Afgekeurd", "5" => "Vervallen");
$items["StatusTekst"] = array("label" => "Status", "value" => $statii[$items["Status"]["value"]]);

However having {StatusTekst:value} in the template results in displaying literally: "{StatusTekst:value}".

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

CB Content Prepare : How to add calculated fields 6 months 2 weeks ago #257329

  • tihana.krivic's Avatar
  • tihana.krivic
  • Offline
  • Moderator
  • Moderator
  • Posts: 7387
  • Karma: 3
  • Thanks: 529
Hi,

is this content builder only or integration with BF?

If this is only content builder you can add new field, and enable "Include in list" for this field, but not enable "Editable". After that this field will be for purpose only

Regards,
Tihana

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

CB Content Prepare : How to add calculated fields 6 months 2 weeks ago #257334

  • Topic Author
  • hverdel
  • Offline
  • Junior Breezer
  • Junior Breezer
  • Posts: 41
  • Thanks: 0
This is CB only.

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

CB Content Prepare : How to add calculated fields 6 months 1 week ago #257346

  • tihana.krivic's Avatar
  • tihana.krivic
  • Offline
  • Moderator
  • Moderator
  • Posts: 7387
  • Karma: 3
  • Thanks: 529
Hi,

If this is only content builder you can add new field, and enable "Include in list" for this field, but not enable "Editable". After that this field will be for purpose only

Did you try this?

Regards,
Tihana

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

CB Content Prepare : How to add calculated fields - 99% solved 6 months 1 week ago #257408

  • Topic Author
  • hverdel
  • Offline
  • Junior Breezer
  • Junior Breezer
  • Posts: 41
  • Thanks: 0
I can only add fields to data sources, not to views.

I have the situation that a composition of fields (for display) depends on some other field value.
This is not a data issue, just a display (view) issue. So i don't want this persisting in my database.

I found a way that's almost what i want. I'll illustrate by means of an example.

My data source has a field "Color", which is a group field. Values are:
Red;1
Green;2
Blue;3
In the "Content prepare" section i have added:
switch ($items["Color"]["value"])
{ case 1: $color = 'Red'; break;
  case 2: $color = 'Green'; break;
  case 3: $color = 'Blue';
}

$coloritem = array("label"=>"ColorTekst", "id"=>"474001", "value"=>$color);
$items["ColorText"] = $coloritem;
(It needs to have an ID, to not be skipped entirely.

Now i can use "{ColorText:value}" in my template without actually having a colortext field, which was the initial goal.

Why almost?
In the contentbuiler.php code the "Content prepare" is processed at a point where the {hide} tags no longer work. Maybe that's something Crosstec can fix some time.
A good alternative is to test before adding the field, but that would still not enable multiple {hide-if-matches} with different values to test. I don't think that would bother many.

Hope this helps.

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

Last edit: Post by hverdel. Reason: Solved (almost)

CB Content Prepare : How to add calculated fields - 99% solved 6 months 1 week ago #257422

  • tihana.krivic's Avatar
  • tihana.krivic
  • Offline
  • Moderator
  • Moderator
  • Posts: 7387
  • Karma: 3
  • Thanks: 529
Hi,

I like it :)

In the contentbuiler.php code the "Content prepare" is processed at a point where the {hide} tags no longer work. Maybe that's something Crosstec can fix some time.
A good alternative is to test before adding the field, but that would still not enable multiple {hide-if-matches} with different values to test. I don't think that would bother many.

Yes, I agree with you, let me research this a little bit :)

Regards,
Tihana

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

  • Page:
  • 1
  • 2
Time to create page: 0.052 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!