- 🇺🇦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; }