/**
  * Build grid from ACF layouts
  *
  */
 protected function build_simple_grid($section_contents)
 {
     $grid = new SimpleGrid($section_contents['select_grid_items'], $this->element);
     $this->output .= $grid->embed();
 }
示例#2
0
function exchange_token_form_callback()
{
    $results = '';
    if (empty(check_ajax_referer('exchange-token-form-nonce', 'security', false))) {
        echo '<div class="loader-pointer section__helper">' . __('Whoa... where did YOU come from?', EXCHANGE_PLUGIN) . '</div>';
        wp_die();
    }
    if (!empty($_POST['prid']) && !empty($_POST['update_id']) && !empty($_POST['token'])) {
        $pr_obj = BaseController::exchange_factory($_POST['prid'], 'token-form');
        $pr_token = $_POST['token'];
        $c_obj = BaseController::exchange_factory($_POST['update_id'], 'token-form');
        $story_page = get_option('options_story_update_form_page');
        $s_obj = get_post($story_page);
        if (!$pr_obj instanceof Programme_Round) {
            echo '<div class="loader-pointer section__helper">' . __('We could not find the right data. Are you sure you have the right link?') . '</div>';
            wp_die();
        }
        // Create array for griditems.
        $simplegrid = new SimpleGrid();
        if ($s_obj instanceof WP_Post) {
            $simplegrid->add_grid_item($pr_obj->create_token_form_cta($s_obj, $pr_token, $c_obj));
        }
        if ($c_obj instanceof Collaboration) {
            $simplegrid->add_grid_item($pr_obj->create_token_form_cta($c_obj, $pr_token));
        }
        if (!empty($c_obj->participants)) {
            foreach ($c_obj->participants as $p) {
                $simplegrid->add_grid_item($pr_obj->create_token_form_cta($p, $pr_token));
            }
        }
        // echo '<pre>' . print_r( $simplegrid, true ) . '</pre>';
        // wp_die();
        echo $simplegrid->embed();
        wp_die();
    } else {
        echo '<div class="loader-pointer section__helper">' . __('We did not receive the request correctly. Make sure you\'ve selected your collaboration and try again!') . '</div>';
        wp_die();
    }
}