Drupal глазами разработчика

Блог музицирующего веб-девелопера: Drupal: AJAX удаление товаров из корзины Drupal Commerce


Работающий, но проблемный код:
<span class="co4">/**
 * Implements hook_form_FORM_ID_alter(): views_form_commerce_cart_form_default.
 */</span>
<span class="kw2">function</span> MODULENAME_form_views_form_commerce_cart_form_default_alter<span class="br0">(</span><span class="sy0">&</span><span class="re0">$form</span><span class="sy0">,</span> <span class="sy0">&</span><span class="re0">$form_state</span><span class="br0">)</span> <span class="br0">{</span>
  <span class="re0">$form</span><span class="br0">[</span><span class="st_h">'#action'</span><span class="br0">]</span> <span class="sy0">=</span> url<span class="br0">(</span><span class="st_h">'cart'</span><span class="br0">)</span><span class="sy0">;</span> <span class="co1">// Проблема 1</span>
  <span class="kw1">if</span> <span class="br0">(</span><span class="sy0">!</span><span class="kw3">empty</span><span class="br0">(</span><span class="re0">$form</span><span class="br0">[</span><span class="st_h">'edit_delete'</span><span class="br0">]</span><span class="br0">)</span><span class="br0">)</span> <span class="br0">{</span>
    <span class="kw1">foreach</span><span class="br0">(</span>element_children<span class="br0">(</span><span class="re0">$form</span><span class="br0">[</span><span class="st_h">'edit_delete'</span><span class="br0">]</span><span class="br0">)</span> <span class="kw1">as</span> <span class="re0">$key</span><span class="br0">)</span> <span class="br0">{</span>

Читать дальше →
Похожие записи:
  • нет
  • 0
  • 0

0 комментариев

Только зарегистрированные и авторизованные пользователи могут оставлять комментарии.