Skip to content

Instantly share code, notes, and snippets.

@litzinger
Created July 24, 2017 20:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save litzinger/deccc26685afeb3a28f179006f501fcf to your computer and use it in GitHub Desktop.
Save litzinger/deccc26685afeb3a28f179006f501fcf to your computer and use it in GitHub Desktop.
{relationship_field:entry_ids} is not available in EE2, but is in EE3. Take the code from EE3 and put it into EE2.
.../expressionengine/libraries/relationship_parser/Parser.php | 10 ++++++++++
.../libraries/relationship_parser/Tree_builder.php | 2 +-
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git system/expressionengine/libraries/relationship_parser/Parser.php system/expressionengine/libraries/relationship_parser/Parser.php
index 6a7d61d21..3cb6bdeed 100644
--- system/expressionengine/libraries/relationship_parser/Parser.php
+++ system/expressionengine/libraries/relationship_parser/Parser.php
@@ -188,6 +188,16 @@ class EE_Relationship_data_parser {
}
}
+ if ($node->shortcut == 'entry_ids')
+ {
+ $delim = (isset($node->params['delimiter'])) ? $node->params['delimiter'] : '|';
+ return str_replace(
+ $node->open_tag,
+ implode($delim, $entry_ids),
+ $tagdata
+ );
+ }
+
$matches = array(array($node->open_tag, $node->open_tag));
}
diff --git system/expressionengine/libraries/relationship_parser/Tree_builder.php system/expressionengine/libraries/relationship_parser/Tree_builder.php
index 1fe63a25b..39a61d33b 100644
--- system/expressionengine/libraries/relationship_parser/Tree_builder.php
+++ system/expressionengine/libraries/relationship_parser/Tree_builder.php
@@ -352,7 +352,7 @@ class EE_relationship_tree_builder {
'tag_info' => array(),
'entry_ids' => array(),
'params' => $params,
- 'shortcut' => $is_only_relationship ? FALSE : $tag,
+ 'shortcut' => $is_only_relationship ? FALSE : ltrim($tag, ':'),
'open_tag' => $match[0],
'in_grid' => $in_grid,
'in_cond' => $type == 'conditional' ? TRUE : FALSE
--
2.11.0 (Apple Git-81)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment