Skip to content

Commit

Permalink
Merge pull request #90 from AlexaCRM/addJsonEncode
Browse files Browse the repository at this point in the history
  • Loading branch information
georged authored Oct 24, 2024
2 parents 12d7d9a + 0106d0f commit 44570be
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
7 changes: 7 additions & 0 deletions datapress/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,13 @@ define('ICDS_FORM_AUTH_KEY', 'ny%:T/j@I>/sMm8Unyi{+~oS/]PQKp3ZXIXb/)iLU|V]Q7gh^e

To generate a suitable key you can use an online generator provided by Wordpress at https://api.wordpress.org/secret-key/1.0/. If you generate key this way you should save this key (go to Dataverse Integration -> Settings tab -> at the end of the page Advanced Settings, paste the key here, one of key - ICDS_AUTH_KEY, when you reload link and get key one more time - ICDS_FORM_AUTH_KEY).

:::note

If you did not set the **ICDS_AUTH_KEY**, it will be generated automarically. However, you must set the **ICDS_FORM_AUTH_KEY** yourself. You can also change either of these keys without disconnecting. The keys should be at least 32 characters long.
If you define them in your **wp-config.php** file, these file values will take precedence.

:::

## Connect the plugin

Once you got required credentials, it's time to connect the plugin to CRM.
Expand Down
9 changes: 9 additions & 0 deletions datapress/knowledge_base/lookup/lookup_free.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,15 @@ In this approach, you’ll serialize the lookup value and store it in a field on
{% endform %}
```

For record or lookup, you can use the **json_encode** filter:

```twig
{% set account = entities.account["9467eea0-70f7-ec11-82e7-002248159955"] %}
{% set accountRef = account | to_entity_reference %}
<input value="{{ accountRef | json_encode }}">
```

### Table:guid

In this approach, you directly use the GUID value from the lookup field to update the record. Note: this method is supported for backward compatibility with v1 plugin only and should not be used when writing new code. The only difference is how the value is set in the `<option>` element.
Expand Down
18 changes: 18 additions & 0 deletions datapress/knowledge_base/twig/add_twig_in_header_footer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
title: Add twig in header/footer
slug: /knowledge-base/add-twig-in-header-footer
sidebar_position: 20
tags:
- Knowledge base
- Code
- Twig
- Datapress
---

To inject dynamic data outside of the page content, you can use direct code in **header.php** or **footer.php** to render the dynamic content:

```php

<?php echo \AlexaCRM\Nextgen\TwigProvider::instance()->renderString('Hello, {{ user.record["fullname"] }}'); ?>

```

0 comments on commit 44570be

Please sign in to comment.