snipt

Ctrl+h for KB shortcuts

PHP

Drupal 7: Add CSS class to Panel from context (as "token" or "keyword replacement")

1
2
3
4
5
6
<?php

// Until the module is updated with this feature (shouldn't take long) you can edit line 295 in panel_context.inc file

//$panel_body_css['body_classes_to_add'] = $handler->conf['body_classes_to_add'];
$panel_body_css['body_classes_to_add'] = ctools_context_keyword_substitute($handler->conf['body_classes_to_add'], array(), $contexts);
https://snipt.net/embed/9538dcaee28ed8a084fb80d80ba0a0a6/
/raw/9538dcaee28ed8a084fb80d80ba0a0a6/
9538dcaee28ed8a084fb80d80ba0a0a6
php
PHP
6
2017-01-01T05:06:05
True
False
True
Jan 29, 2013 at 06:41 AM
/api/public/snipt/54706/
drupal-7-add-css-class-to-panel-from-context-as-token-or-keyword-replacement
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a> <a href="#L-5">5</a> <a href="#L-6">6</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="cp">&lt;?php</span> </span><span id="L-2"><a name="L-2"></a> </span><span id="L-3"><a name="L-3"></a><span class="c1">// Until the module is updated with this feature (shouldn&#39;t take long) you can edit line 295 in panel_context.inc file</span> </span><span id="L-4"><a name="L-4"></a> </span><span id="L-5"><a name="L-5"></a><span class="c1">//$panel_body_css[&#39;body_classes_to_add&#39;] = $handler-&gt;conf[&#39;body_classes_to_add&#39;];</span> </span><span id="L-6"><a name="L-6"></a><span class="nv">$panel_body_css</span><span class="p">[</span><span class="s1">&#39;body_classes_to_add&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="nx">ctools_context_keyword_substitute</span><span class="p">(</span><span class="nv">$handler</span><span class="o">-&gt;</span><span class="na">conf</span><span class="p">[</span><span class="s1">&#39;body_classes_to_add&#39;</span><span class="p">],</span> <span class="k">array</span><span class="p">(),</span> <span class="nv">$contexts</span><span class="p">);</span> </span></pre></div> </td></tr></table>
"drupal 7", "keyword replacement", class, css, panel, token