- 🇺🇦Ukraine dunot
function mymodule_token_info() { $eck_type['element'] = [ 'name' => t("eck"), 'description' => t("Tokens related to eck"), 'needs-data' => 'machine_name_of_your_eck', ]; .. $eck['id'] = [ // add this token п.ч. пропадает 'name' => t("eck id"), 'description' => t("Id of eck"), ]; return [ 'types' => [ .. 'element' => $eck_type ], 'tokens' => [ .. 'element' => $eck ], ]; } function .._tokens($type, $tokens, array $data, array $options, BubbleableMetadata $bubbleable_metadata) { $replacements = []; if ($type == 'machine_name_of_your_eck' && !empty($data['machine_name_of_your_eck'])) { $eck = $data['element']; $eck_id = $eck->id(); foreach ($tokens as $name => $original) { switch ($name) { case 'id': $replacements[$original] = $eck_id; break; .. } } return $replacements; }
- Status changed to Closed: works as designed
4 months ago 12:53pm 26 December 2024 - 🇧🇪Belgium dieterholvoet Brussels
Source of this problem seems is missing `ID` field in display settings. Can we add `ID` field to display?
Not sure what the problem is here, but id fields aren't usually available in view displays. I'm going to close this issue since it's very old, but feel free to reopen if someone is still experiencing this.