Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update Fields binding description #108

Merged
merged 1 commit into from
Jan 12, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 19 additions & 16 deletions datapress/binding/fields.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,25 +24,28 @@ Premium feature! This feature is available in the addon to the premium extension

:::

With the Dataverse Integration Fields Binding plugin available in the Addons, you can work with custom fields, allowing you to display any text before displaying the field value and formatting the field value.
With the Dataverse Integration Fields Binding plugin available in the Addons, you can work with custom fields, allowing you to display any text before displaying the field value and format the field value.

To use this plugin, follow the steps below:
1. Create a page, click `Preferences`, and open the `Panel` settings.
2. Add extra areas to the editor by choosing `Custom fields` option. Click `Enable & Reload` to see the Custom fields section.
3. At the bottom of the page, create a name for custom field(s). Save and publish the page.
4. Go to the pages list, find the page you created and click `Configure Binding` to choose the table to bind.
5. In the Dataverse Admin Area, go to `Bindings` -> `Fields Binding`. Here, you can set pre-rendering Twig code that will execute before rendering Twig expression substitution. You can use it to retrieve data, define variables, etc.
6. Click `Create Binding`, and choose the page that was created earlier. Then select `Add Field` and choose the custom field created for the page.

Additionally, the following options will replace a field:
1. In the Dataverse Admin Area, navigate to Bindings -> Fields Binding. Here, you can set pre-rendering Twig code that will execute before rendering Twig expression substitution. Use this to retrieve data, define variables, and more.
2. Select `Add field` to choose the custom field to display or click `Create field` to create a new custom field.
3. Add a table from which to retrieve data.
4. Click Save.
5. Return to the WordPress Admin Area and create a page. Click `Preferences`, then open the `Panel` settings.
6. Add extra areas to the editor by choosing `Custom fields` option. Click `Enable & Reload` to see the Custom fields section.
7. At the bottom of the page, create a name for custom field(s). Save and publish the page.
8. Go to the pages list, find the page you created and click `Configure Binding` to choose the table to bind and how to bind the post.

- Twig Expression (type Twig expression to display it as the field value)
- Column (choose the column logical name from the drop-down)
- Twig Template (choose the Twig template, which is in Templates -> Twig templates)
- Formatted Column (choose the column logical name from the drop-down).
Additionally, the following options can replace a field:

Add the output of the meta field to your template:
- **Twig Expression:** Type a Twig expression to display it as the field value.
- **Column:** Choose the column logical name from the drop-down.
- **Twig Template:** Choose the Twig template, which can be found under `Templates` -> `Twig Templates`.
- **Formatted Column:** Choose the column logical name from the drop-down.

```php
<?= get_post_meta( get_the_ID(), '{fieldName}', true ); ?>
```
:::note

The selected table in the Configure Binding item must match the table for this custom field in the Dataverse Admin Area.

:::
Loading