Skip Navigation

[Resolved] Get repeatble field values in specific custom block

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 1 reply, has 2 voices.

Last updated by Minesh 1 year, 7 months ago.

Assisted by: Minesh.

Author
Posts
#2673975
repeatableCustomsFieldsInPublicationEdit.JPG
blockInModel.JPG
repeatbleField.JPG

Hi,

I need to create a svg graph from repeatable field values as data for custom publication type.

I had create the model, and a block based on acf block. But a can't get any data from toolset custom field.

content of block.json :

{
"name": "data-graph/aograph",
"title": "Graphique",
"description": "Graphique de données pour Appel d'offre",
"style": [
"file:./aoGraph.css"
],
"category": "formatting",
"icon": "images-alt",
"apiVersion": 2,
"keywords": [],
"acf": {
"mode": "preview",
"renderTemplate": "aoGraph.php"
},
"supports": {
"align": false,
"anchor": false,
"alignContent": false,
"color": {
"text": false,
"background": true,
"link": false
},
"alignText": false,
"fullHeight": false
}
}

Images :
repeatable fields edit
Block in model : call block Graphisme in model
Repeatable custom fields in publication edition

Source of php block render

<?php
/**
* Block template.
*
* @param array $block The block settings and attributes.
*/
$id = get_the_ID();
?>
HELLO WORLD <?php echo "ID {$id}"; ?>

<?php
$value = types_render_termmeta( "Effectif",array( "output" => 'raw' ) );

if( $value ) {
echo $value;
} else {
echo 'empty';
}
?>

I can get the post id, but no data with get_field() or types_render_termmeta() for simple or repeatable fields

How to do to get values of my repeatable or simple field in this block ?

Thank you ,

Best regard,

#2674331

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Here is the Doc that shows information about how you can display the repeating field group using the PHP:
- https://toolset.com/documentation/customizing-sites-using-php/displaying-repeatable-groups-of-fields/#displaying-repeatable-field-group

To display the custom term field value using PHP - either you will have to create a view that should set to query the taxonomy and format the loop output to display term fields or you will have to pass the term_id as attribute:

For example:

types_render_termmeta( "my-field", array('term_id'=> 999) );

Where:
- Replace 999 with your required term id.

More info:
- https://toolset.com/documentation/displaying-wordpress-term-fields/