0

There is no field in manage display of content type to display Flag link. There is a tpl file (node--article--teaser.tpl.php) for teaser mode displaying bookmark

<?php if (isset($content['links']['flag'])) : ?>
    <?php echo render($content['links']['flag']);?>
<?php endif; ?>

But for another mode this having View mode teaser_2_col and tpl file name node--teaser-2-col.tpl.php, $content['links'] does not have a Flag element.

0

You can use flag_create_link() function to create the link and print it.

Usage:

If the flag was created for the content type, then the flag can be printed using:

<?php print flag_create_link('flag_machine_name', $node->nid); ?>

Note: The second argument is the id of the entity for which the flag was created.

2

You actually can display a Flag link as a pseudofield, which can be ordered among other entity elements in the Manage display settings for an entity type. Go to admin/structure/flags and pick the Flag that you need. Next, check Display link as field in the section Display in entity links. You can now use the link in your template files by rendering the node and getting the right field (use Devel for this).

Alternatively, you can output a Flag link by using flag_create_link($flag_name, $entity_id). In that case you don't need a pseudofield.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.