In #2484843: Allow widgets to control how their "example" is rendered on the "Add content" dialog (including using a static image rather than rendering) Panopoly added the ability to define custom preview examples for widgets. The image preview could be improved by adding optional alt text.

Comments

cboyden created an issue. See original summary.

cboyden’s picture

Assigned: cboyden » Unassigned
Status: Active » Needs review
StatusFileSize
new1.04 KB

Here's a patch that looks for alt text for the image and passes 'alt' => NULL to the theme function if it's not set. Does this text need any sanitizing or translation? Should translation happen in the downstream hook implementation?

dsnopek’s picture

Status: Needs review » Needs work
+++ b/panopoly_magic.module
@@ -1567,7 +1567,10 @@ function panopoly_magic_preview_callback_fpp($type, $subtype, $plugin, $renderer
+    $plugin['preview image alt'] == NULL;

One two many '=' signs: this is the boolean operator rather than the assignment operator.

However, other than that, this idea looks good!

Does this text need any sanitizing or translation? Should translation happen in the downstream hook implementation?

I think this is fine. The only way currently to set these values is in code, which means it's on that code to call t() on the values it sets.

cboyden’s picture

Status: Needs work » Needs review
StatusFileSize
new1.04 KB

Whoops! See updated patch.

  • dsnopek committed d3f9d08 on 7.x-1.x
    Update Panopoly Magic for Issue #2981684 by cboyden: Add alt text for...
dsnopek’s picture

Status: Needs review » Fixed

Thanks, committed!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.