For some reason there is already an option to toggle labels on/off, but only appears if there is a layer with the class esri.layers.LabelLayer in the web map. To make this option more useful, I think it should add showLabels false to the layerDefinition in the Web_Map_to_JSON. Please check following patch, based on WAB 2.9, to understand what I mean.
diff <SPAN class="operator token">--</SPAN>git a<SPAN class="operator token">/</SPAN>server<SPAN class="operator token">/</SPAN>apps<SPAN class="operator token">/</SPAN><SPAN class="number token">2</SPAN><SPAN class="operator token">/</SPAN>widgets<SPAN class="operator token">/</SPAN>Print<SPAN class="operator token">/</SPAN>Print<SPAN class="punctuation token">.</SPAN>js b<SPAN class="operator token">/</SPAN>server<SPAN class="operator token">/</SPAN>apps<SPAN class="operator token">/</SPAN><SPAN class="number token">2</SPAN><SPAN class="operator token">/</SPAN>widgets<SPAN class="operator token">/</SPAN>Print<SPAN class="operator token">/</SPAN>Print<SPAN class="punctuation token">.</SPAN>js
index be9b20d2<SPAN class="punctuation token">.</SPAN><SPAN class="punctuation token">.</SPAN>b3fea565 <SPAN class="number token">100644</SPAN>
<SPAN class="operator token">--</SPAN><SPAN class="operator token">-</SPAN> a<SPAN class="operator token">/</SPAN>server<SPAN class="operator token">/</SPAN>apps<SPAN class="operator token">/</SPAN><SPAN class="number token">2</SPAN><SPAN class="operator token">/</SPAN>widgets<SPAN class="operator token">/</SPAN>Print<SPAN class="operator token">/</SPAN>Print<SPAN class="punctuation token">.</SPAN>js
<SPAN class="operator token">++</SPAN><SPAN class="operator token">+</SPAN> b<SPAN class="operator token">/</SPAN>server<SPAN class="operator token">/</SPAN>apps<SPAN class="operator token">/</SPAN><SPAN class="number token">2</SPAN><SPAN class="operator token">/</SPAN>widgets<SPAN class="operator token">/</SPAN>Print<SPAN class="operator token">/</SPAN>Print<SPAN class="punctuation token">.</SPAN>js
@@ <SPAN class="operator token">-</SPAN><SPAN class="number token">138</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="number token">13</SPAN> <SPAN class="operator token">+</SPAN><SPAN class="number token">138</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="number token">8</SPAN> @@ <SPAN class="token function">define</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">[</SPAN>
html<SPAN class="punctuation token">.</SPAN><SPAN class="token function">setStyle</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="keyword token">this</SPAN><SPAN class="punctuation token">.</SPAN>titleTr<SPAN class="punctuation token">,</SPAN> <SPAN class="string token">'display'</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">''</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="punctuation token">}</SPAN>
<SPAN class="operator token">-</SPAN> <SPAN class="keyword token">if</SPAN> <SPAN class="punctuation token">(</SPAN><SPAN class="keyword token">this</SPAN><SPAN class="punctuation token">.</SPAN><SPAN class="token function">_hasLabelLayer</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN>
<SPAN class="operator token">-</SPAN> html<SPAN class="punctuation token">.</SPAN><SPAN class="token function">setStyle</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="keyword token">this</SPAN><SPAN class="punctuation token">.</SPAN>labelsFormDijit<SPAN class="punctuation token">.</SPAN>domNode<SPAN class="punctuation token">,</SPAN> <SPAN class="string token">'display'</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">''</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="operator token">-</SPAN> html<SPAN class="punctuation token">.</SPAN><SPAN class="token function">setStyle</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="keyword token">this</SPAN><SPAN class="punctuation token">.</SPAN>labelsTitleNode<SPAN class="punctuation token">,</SPAN> <SPAN class="string token">'display'</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">''</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="operator token">-</SPAN> <SPAN class="punctuation token">}</SPAN> <SPAN class="keyword token">else</SPAN> <SPAN class="punctuation token">{</SPAN>
<SPAN class="operator token">-</SPAN> html<SPAN class="punctuation token">.</SPAN><SPAN class="token function">setStyle</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="keyword token">this</SPAN><SPAN class="punctuation token">.</SPAN>labelsFormDijit<SPAN class="punctuation token">.</SPAN>domNode<SPAN class="punctuation token">,</SPAN> <SPAN class="string token">'display'</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">'none'</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="operator token">-</SPAN> html<SPAN class="punctuation token">.</SPAN><SPAN class="token function">setStyle</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="keyword token">this</SPAN><SPAN class="punctuation token">.</SPAN>labelsTitleNode<SPAN class="punctuation token">,</SPAN> <SPAN class="string token">'display'</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">'none'</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="operator token">-</SPAN> <SPAN class="punctuation token">}</SPAN>
<SPAN class="operator token">+</SPAN> html<SPAN class="punctuation token">.</SPAN><SPAN class="token function">setStyle</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="keyword token">this</SPAN><SPAN class="punctuation token">.</SPAN>labelsFormDijit<SPAN class="punctuation token">.</SPAN>domNode<SPAN class="punctuation token">,</SPAN> <SPAN class="string token">'display'</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">''</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="operator token">+</SPAN> html<SPAN class="punctuation token">.</SPAN><SPAN class="token function">setStyle</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="keyword token">this</SPAN><SPAN class="punctuation token">.</SPAN>labelsTitleNode<SPAN class="punctuation token">,</SPAN> <SPAN class="string token">'display'</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">''</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
LayerInfos<SPAN class="punctuation token">.</SPAN><SPAN class="token function">getInstance</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="keyword token">this</SPAN><SPAN class="punctuation token">.</SPAN>map<SPAN class="punctuation token">,</SPAN> <SPAN class="keyword token">this</SPAN><SPAN class="punctuation token">.</SPAN>map<SPAN class="punctuation token">.</SPAN>itemInfo<SPAN class="punctuation token">)</SPAN>
<SPAN class="punctuation token">.</SPAN><SPAN class="token function">then</SPAN><SPAN class="punctuation token">(</SPAN>lang<SPAN class="punctuation token">.</SPAN><SPAN class="token function">hitch</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="keyword token">this</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="keyword token">function</SPAN><SPAN class="punctuation token">(</SPAN>layerInfosObj<SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN>
@@ <SPAN class="operator token">-</SPAN><SPAN class="number token">188</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="number token">6</SPAN> <SPAN class="operator token">+</SPAN><SPAN class="number token">183</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="number token">12</SPAN> @@ <SPAN class="token function">define</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">[</SPAN>
<SPAN class="keyword token">false</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="punctuation token">}</SPAN>
<SPAN class="keyword token">if</SPAN> <SPAN class="punctuation token">(</SPAN><SPAN class="keyword token">this</SPAN><SPAN class="punctuation token">.</SPAN>printTask<SPAN class="punctuation token">.</SPAN>_createOperationalLayers<SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN>
<SPAN class="operator token">+</SPAN> aspect<SPAN class="punctuation token">.</SPAN><SPAN class="token function">after</SPAN><SPAN class="punctuation token">(</SPAN>
<SPAN class="operator token">+</SPAN> <SPAN class="keyword token">this</SPAN><SPAN class="punctuation token">.</SPAN>printTask<SPAN class="punctuation token">,</SPAN>
<SPAN class="operator token">+</SPAN> <SPAN class="string token">'_createOperationalLayers'</SPAN><SPAN class="punctuation token">,</SPAN>
<SPAN class="operator token">+</SPAN> lang<SPAN class="punctuation token">.</SPAN><SPAN class="token function">hitch</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="keyword token">this</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">'_hideLabels'</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="operator token">+</SPAN> <SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="operator token">+</SPAN>
<SPAN class="comment token">// if opLayers contains markerSymbol of map.infoWindow, the print job will failed</SPAN>
aspect<SPAN class="punctuation token">.</SPAN><SPAN class="token function">after</SPAN><SPAN class="punctuation token">(</SPAN>
<SPAN class="keyword token">this</SPAN><SPAN class="punctuation token">.</SPAN>printTask<SPAN class="punctuation token">,</SPAN>
@@ <SPAN class="operator token">-</SPAN><SPAN class="number token">202</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="number token">13</SPAN> <SPAN class="operator token">+</SPAN><SPAN class="number token">203</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="number token">6</SPAN> @@ <SPAN class="token function">define</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">[</SPAN>
<SPAN class="punctuation token">}</SPAN>
<SPAN class="punctuation token">}</SPAN><SPAN class="punctuation token">,</SPAN>
<SPAN class="operator token">-</SPAN> _hasLabelLayer<SPAN class="punctuation token">:</SPAN> <SPAN class="keyword token">function</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN>
<SPAN class="operator token">-</SPAN> <SPAN class="keyword token">return</SPAN> array<SPAN class="punctuation token">.</SPAN><SPAN class="token function">some</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="keyword token">this</SPAN><SPAN class="punctuation token">.</SPAN>map<SPAN class="punctuation token">.</SPAN>graphicsLayerIds<SPAN class="punctuation token">,</SPAN> <SPAN class="keyword token">function</SPAN><SPAN class="punctuation token">(</SPAN>glid<SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN>
<SPAN class="operator token">-</SPAN> <SPAN class="keyword token">var</SPAN> l <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">this</SPAN><SPAN class="punctuation token">.</SPAN>map<SPAN class="punctuation token">.</SPAN><SPAN class="token function">getLayer</SPAN><SPAN class="punctuation token">(</SPAN>glid<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="operator token">-</SPAN> <SPAN class="keyword token">return</SPAN> l <SPAN class="operator token">&&</SPAN> l<SPAN class="punctuation token">.</SPAN>declaredClass <SPAN class="operator token">===</SPAN> <SPAN class="string token">'esri.layers.LabelLayer'</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="operator token">-</SPAN> <SPAN class="punctuation token">}</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="keyword token">this</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="operator token">-</SPAN> <SPAN class="punctuation token">}</SPAN><SPAN class="punctuation token">,</SPAN>
<SPAN class="operator token">-</SPAN>
_getPrintTaskInfo<SPAN class="punctuation token">:</SPAN> <SPAN class="keyword token">function</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN>
<SPAN class="comment token">// portal own print url: portalname/arcgis/sharing/tools/newPrint</SPAN>
<SPAN class="keyword token">var</SPAN> def <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">Deferred</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
@@ <SPAN class="operator token">-</SPAN><SPAN class="number token">276</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="number token">6</SPAN> <SPAN class="operator token">+</SPAN><SPAN class="number token">270</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="number token">19</SPAN> @@ <SPAN class="token function">define</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">[</SPAN>
<SPAN class="keyword token">return</SPAN> def<SPAN class="punctuation token">;</SPAN>
<SPAN class="punctuation token">}</SPAN><SPAN class="punctuation token">,</SPAN>
<SPAN class="operator token">+</SPAN> _hideLabels<SPAN class="punctuation token">:</SPAN> <SPAN class="keyword token">function</SPAN><SPAN class="punctuation token">(</SPAN>opLayers<SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN>
<SPAN class="operator token">+</SPAN> checkbox <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">this</SPAN><SPAN class="punctuation token">.</SPAN>labelsFormDijit<SPAN class="punctuation token">.</SPAN><SPAN class="keyword token">get</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">'value'</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="operator token">+</SPAN> <SPAN class="keyword token">if</SPAN> <SPAN class="punctuation token">(</SPAN> <SPAN class="operator token">!</SPAN>checkbox<SPAN class="punctuation token">.</SPAN>showLabels<SPAN class="punctuation token">[</SPAN><SPAN class="number token">0</SPAN><SPAN class="punctuation token">]</SPAN> <SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN>
<SPAN class="operator token">+</SPAN> array<SPAN class="punctuation token">.</SPAN><SPAN class="token function">forEach</SPAN><SPAN class="punctuation token">(</SPAN>opLayers<SPAN class="punctuation token">,</SPAN> <SPAN class="keyword token">function</SPAN><SPAN class="punctuation token">(</SPAN>ol<SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN>
<SPAN class="operator token">+</SPAN> array<SPAN class="punctuation token">.</SPAN><SPAN class="token function">forEach</SPAN><SPAN class="punctuation token">(</SPAN>ol<SPAN class="punctuation token">.</SPAN>layers<SPAN class="punctuation token">,</SPAN> <SPAN class="keyword token">function</SPAN><SPAN class="punctuation token">(</SPAN>layer<SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN>
<SPAN class="operator token">+</SPAN> layer<SPAN class="punctuation token">.</SPAN>layerDefinition<SPAN class="punctuation token">.</SPAN>drawingInfo <SPAN class="operator token">=</SPAN> <SPAN class="punctuation token">{</SPAN><SPAN class="punctuation token">}</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="operator token">+</SPAN> layer<SPAN class="punctuation token">.</SPAN>layerDefinition<SPAN class="punctuation token">.</SPAN>drawingInfo<SPAN class="punctuation token">.</SPAN>showLabels <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">false</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="operator token">+</SPAN> <SPAN class="punctuation token">}</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="operator token">+</SPAN> <SPAN class="punctuation token">}</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="keyword token">this</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="operator token">+</SPAN> <SPAN class="punctuation token">}</SPAN>
<SPAN class="operator token">+</SPAN> <SPAN class="keyword token">return</SPAN> opLayers<SPAN class="punctuation token">;</SPAN>
<SPAN class="operator token">+</SPAN> <SPAN class="punctuation token">}</SPAN><SPAN class="punctuation token">,</SPAN>
<SPAN class="operator token">+</SPAN>
_fixInvalidSymbol<SPAN class="punctuation token">:</SPAN> <SPAN class="keyword token">function</SPAN><SPAN class="punctuation token">(</SPAN>opLayers<SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN>
array<SPAN class="punctuation token">.</SPAN><SPAN class="token function">forEach</SPAN><SPAN class="punctuation token">(</SPAN>opLayers<SPAN class="punctuation token">,</SPAN> <SPAN class="keyword token">function</SPAN><SPAN class="punctuation token">(</SPAN>ol<SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN>
<SPAN class="keyword token">if</SPAN> <SPAN class="punctuation token">(</SPAN>ol<SPAN class="punctuation token">.</SPAN>id <SPAN class="operator token">===</SPAN> <SPAN class="string token">'map_graphics'</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN>
<SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>