16.2 Hiển thị những phần đã lọc ra popup (ok)

C:\xampp\htdocs\test\wp-content\plugins\plugin-name\includes\class-wpf-form_ct.php

public function form() {
    $sort_cmb  = array_merge(WPF_Utils_CT::get_wc_attributes(), WPF_Utils_CT::get_default_fields());
    $languages = array(
      'en' => array(
        'name'     => '',
        'selected' => true,
      ),
    );
    natcasesort($sort_cmb);
    $layout = $data = array();
    if (!empty($this->themplate_id)) {
      // $option = WPF_Options::get_option($this->plugin_name, $this->version);
      $option = WPF_Options_CT::get_option('wpf', $this->version);
      $forms = $option->get();
      if (!empty($forms[$this->themplate_id])) {
        $layout = $forms[$this->themplate_id];
        $data = $layout['data'];
        $layout = $layout['layout'];
      }
    }
    $this->add_fields($data);
    ?>
      <input type="hidden" value="" name="layout" id="wpf_ct_layout" />
      <input type="hidden" value="<?php echo $this->themplate_id ?>" id="wpf_themplate_id" name="themplate_id" />
      <div class="wpf_ct_back_builder">
        <div class="wpf_ct_back_module_panel">
          <?php foreach ($sort_cmb as $type => $name): ?>
            <div <?php if (!empty($layout[$type])): ?>style="display:none;"<?php endif; ?> data-type="<?php echo $type ?>" id="wpf_ct_cmb_<?php echo $type ?>" class="wpf_ct_back_module"> 
              <?php $this->module($type, $name, array(), $languages); ?>
            </div>
          <?php endforeach; ?>
        </div>
        <div class="wpf_ct_back_row_content" id="wpf_ct_module_content">  
          <div class="wpf_ct_module_holder">
            <div class="wpf_empty_holder_text"><?php _e('Drop module here', 'wpf') ?></div>
            <?php if (!empty($layout)): ?>
              <?php foreach ($layout as $type => $module): ?>
                <?php
                  if (empty($sort_cmb[$type])) continue;
                  $name = $sort_cmb[$type];
                ?>
                <div data-type="<?php echo $type ?>" class="wpf_back_module wpf_dragged">
                  <?php $this->module($type, $name, $module, $languages); ?>
                </div>
              <?php endforeach; ?>
            <?php endif; ?>
          </div>
        </div>
      </div>
    <?php
  }

Last updated