Allow the link text in the block to submit a claim contain HTML.

Comments

monstrfolk created an issue. See original summary.

nikunjkotecha’s picture

Assigned: Unassigned » nikunjkotecha
Status: Needs review » Active

@monstrfolk

I am thinking of implementing some alter hooks to tackle such cases, it won't be good to allow HTML directly but it is OK if developer wants to allow it and not something that admin does directly.

Does that make sense?

Thanks,
Nikunj

monstrfolk’s picture

I understand, but does that really matter since the admin is a trusted user?

nikunjkotecha’s picture

Not really, for some scenarios it might be available to semi-admins, content managers or other non-technical admins. Idea is to avoid styles being broken. If it is required for the project, developer can alter it and allow html and add required conditions, styles to handle the html.

monstrfolk’s picture

it makes using features such as font awesome icons very hard to use by disallowing HTML.

nikunjkotecha’s picture

I got your point. Give me time till tomorrow, I'll implement what I'm thinking and will share here for your review.

monstrfolk’s picture

Awesome. Thanks for going through all of the patches. I really like this module.

nikunjkotecha’s picture

@monsterfolk

Please review the below diff

diff --git a/includes/entity_claim.block.inc b/includes/entity_claim.block.inc
index dd8c64a..77e86bc 100644
--- a/includes/entity_claim.block.inc
+++ b/includes/entity_claim.block.inc
@@ -118,6 +118,9 @@
       $link_options = array();
       $link_options['attributes']['class'][] = $class;
 
+      // Allow other modules to add classes, allow html, etc.
+      drupal_alter('entity_claim_link_options', $link_options, $entity_wrapper);
+
       if (user_is_anonymous() && entity_claim_add_access($type, $entity_wrapper->getIdentifier())) {
         $link_options['query'] = array('destination' => $claim_link);
         $link = l($text, 'user/login', $link_options);
@@ -128,7 +131,6 @@
         $block['content'] = $link;
       }
     }
-
   }
 
   return $block;

With this you can check for a field in the entity and add class based on a category or something, or if you want html directly, just add that in the link_options. Let me know if this makes sense.

  • nikunjkotecha committed 05c8128 on 7.x-1.x
    Issue #2798969 by monstrfolk: HTML in block link text.
    
    Implemented...
nikunjkotecha’s picture

Status: Active » Closed (fixed)
monstrfolk’s picture

works