Output a field
public static field ( string $name, mixed $value, string $type = 'text', array $options = null, array $pod = null, integer $id = null ) : string | ||
$name | string | Field name |
$value | mixed | Field value |
$type | string | Field type |
$options | array | Field options |
$pod | array | Pod data |
$id | integer | Item ID |
Résultat | string | Field HTML |
function wizard_form($data = null, $name = null, $data_name, $data_text, $checked = true) { if (!empty($data)) { ?> <div class="stuffbox pods-package-import-group"> <h3><label for="link_name"><?php _e($data_text, 'pods'); ?> </label></h3> <div class="inside pods-manage-field pods-dependency"> <div class="pods-field-option-group"> <p> <a href="#toggle" class="button pods-wizard-toggle-all" data-toggle="<?php echo $data_name; ?> "><?php _e('Toggle all on / off', 'pods'); ?> </a> </p> <div class="pods-pick-values pods-pick-checkbox pods-zebra"> <ul> <?php $zebra = false; foreach ($data as $item) { $class = $zebra ? 'even' : 'odd'; $zebra = !$zebra; ?> <li class="pods-zebra-<?php echo $class; ?> "> <?php echo PodsForm::field($data_name . '[' . $item[$name] . ']', $checked, 'boolean', array('boolean_yes_label' => $item['name'] . (!empty($item['label']) ? ' (' . $item['label'] . ')' : ''))); ?> </li> <?php } ?> </ul> </div> </div> </div> </div> <?php } }
if (!isset($pods_tab_form)) { $row_name = 'field_data[' . $pods_i . '][' . $field_group_name . ']'; } $value = $field_group_option['default']; if (isset($field_group_option['value']) && 0 < strlen($field_group_option['value'])) { $value = $field_group_option['value']; } else { $value = pods_var_raw($field_group_name, $field, $value); } ?> <li class="<?php echo esc_attr($depends_option); ?> "> <?php echo PodsForm::field($row_name, $value, $field_group_option['type'], $field_group_option); ?> </li> <?php } ?> </ul> </div> </div> <?php } if (false !== $depends_on || !empty($depends)) { $depends_on = $depends; } } if (!empty($depends_on)) {
<div class="pods-pick-values pods-pick-checkbox pods-zebra"> <ul> <?php $zebra = false; foreach ($data as $item) { $checked = true; $class = $zebra ? 'even' : 'odd'; $zebra = !$zebra; ?> <li class="pods-zebra-<?php echo $class; ?> "> <?php echo PodsForm::field($data_name . '[' . $item['id'] . ']', $checked, 'boolean', array('boolean_yes_label' => $item['name'] . (!empty($item['label']) ? ' (' . $item['label'] . ')' : ''))); ?> </li> <?php } ?> </ul> </div> </div> </div> </div> <?php } do_action('pods_packages_export_options', $pods, $pod_templates, $pod_pages, $pod_helpers); ?> </div>
<?php foreach ($field_option['group'] as $field_group_name => $field_group_option) { $field_group_option = PodsForm::field_setup($field_group_option, null, $field_group_option['type']); if ('boolean' != $field_group_option['type']) { continue; } $field_group_option['boolean_yes_label'] = $field_group_option['label']; $depends_option = PodsForm::dependencies($field_group_option); $value = pods_var_raw($field_group_name, $settings, $field_group_option['default']); ?> <li class="<?php echo $depends_option; ?> "> <?php echo PodsForm::field('pods_setting_' . $field_group_name, $value, $field_group_option['type'], $field_group_option); ?> </li> <?php } ?> </ul> </td> </tr> <?php } if (false !== $depends_on || !empty($depends)) { $depends_on = $depends; } } if (!empty($depends_on)) {
</p> <div class="pods-pick-values pods-pick-checkbox pods-zebra"> <ul> <?php $zebra = false; foreach ($this->exportable_pods() as $this_pod) { $class = $zebra ? 'even' : 'odd'; $zebra = !$zebra; ?> <li class="pods-zebra-<?php echo $class; ?> "> <?php echo PodsForm::field($this_pod['name'], true, 'boolean', array('boolean_yes_label' => $this_pod['name'] . (!empty($this_pod['label']) ? ' (' . $this_pod['label'] . ')' : ''))); ?> </li> <?php } ?> </ul> </div> <div class="submit"> <a class="button button-primary" id="export" href="#"> Export </a> </div> <textarea id="feedback"></textarea> </div> </div> </div> </form>
echo esc_attr($action); ?> "> <input type="hidden" name="type" value="<?php echo esc_attr($pod->pod); ?> " /> <?php foreach ($fields as $name => $field) { if ('pick' == $field['type'] && 'pick-custom' != $field['pick_object'] && !empty($field['pick_object'])) { $field['options']['pick_format_type'] = 'single'; $field['options']['pick_format_single'] = 'dropdown'; $field['options']['pick_select_text'] = '-- ' . $field['label'] . ' --'; $filter = pods_var_raw('filter_' . $name, 'get', ''); echo PodsForm::field('filter_' . $name, $filter, 'pick', $field, $pod->pod, $pod->id()); } } ?> <input type="text" class="pods-form-filters-search" name="<?php echo esc_attr($pod->search_var); ?> " value="<?php echo esc_attr($search); ?> " /> <input type="submit" class="pods-form-filters-submit" value="<?php echo esc_attr($label); ?>
<?php if (!pods_tableless() && apply_filters('pods_admin_setup_add_extend_storage', false)) { ?> <div class="pods-depends-on pods-depends-on-extend-pod-type pods-depends-on-extend-pod-type-post-type pods-depends-on-extend-pod-type-media pods-depends-on-extend-pod-type-user pods-depends-on-extend-pod-type-comment"> <p><a href="#pods-advanced" class="pods-advanced-toggle"><?php _e('Advanced', 'pods'); ?> +</a></p> <div class="pods-advanced"> <div class="pods-field-option"> <?php echo PodsForm::label('extend_storage', __('Storage Type', 'pods'), array(__('<h6>Storage Types</h6> Table based storage will operate in a way where each field you create for your content type becomes a field in a table. Meta based storage relies upon the WordPress meta storage table for all field data.', 'pods'), 'http://pods.io/docs/comparisons/compare-storage-types/')); $data = array('meta' => __('Meta Based (WP Default)', 'pods'), 'table' => __('Table Based', 'pods')); echo PodsForm::field('extend_storage', pods_var_raw('extend_storage', 'post'), 'pick', array('data' => $data)); ?> </div> </div> </div> <?php } ?> </div> </div> </div> </div> <div id="pods-wizard-actions"> <div id="pods-wizard-toolbar"> <a href="#start" id="pods-wizard-start" class="button button-secondary"><?php
foreach ($fields as $field) { if ('hidden' == $field['type']) { continue; } ?> <tr class="form-field pods-field <?php echo 'pods-form-ui-row-type-' . $field['type'] . ' pods-form-ui-row-name-' . PodsForm::clean($field['name'], true); ?> "> <th scope="row" valign="top"><?php echo PodsForm::label('pods_field_' . $field['name'], $field['label'], $field['help'], $field); ?> </th> <td> <?php echo PodsForm::field('pods_field_' . $field['name'], $pod->field(array('name' => $field['name'], 'in_form' => true)), $field['type'], $field, $pod, $pod->id()); ?> <?php echo PodsForm::comment('pods_field_' . $field['name'], $field['description'], $field); ?> </td> </tr> <?php } ?> </table> </div> <!-- /.inside --> </div> <!-- /#pods-meta-box --> </div>
?> </p> <div class="pods-pick-values pods-pick-checkbox"> <ul> <li> <?php echo PodsForm::field('field_data[' . $pods_i . '][required]', pods_var_raw('required', $field, 0), 'boolean', array('class' => 'pods-dependent-toggle', 'boolean_yes_label' => __('Required', 'pods'), 'help' => __('help', 'pods'))); ?> </li> <?php if ('table' == $pod['storage']) { ?> <li class="pods-excludes-on pods-excludes-on-field-data-type pods-excludes-on-field-data-type-pick pods-excludes-on-field-data-type-file pods-excludes-on-field-data-type-boolean pods-excludes-on-field-data-type-date pods-excludes-on-field-data-type-datetime pods-excludes-on-field-data-type-time"> <?php echo PodsForm::field('field_data[' . $pods_i . '][unique]', pods_var_raw('unique', $field, 0), 'boolean', array('class' => 'pods-dependent-toggle', 'boolean_yes_label' => __('Unique', 'pods'), 'help' => __('help', 'pods'))); ?> </li> <?php } ?> </ul> </div> </div> </div> <?php foreach ($field_tabs as $tab => $tab_label) { $tab = sanitize_title($tab); if ('basic' == $tab || !isset($field_tab_options[$tab]) || empty($field_tab_options[$tab])) { continue;
<p class="pods-field-option-group-label"> <?php echo PodsForm::label('custom_capabilities[0]', __('Custom Capabilities', 'pods'), __('These capabilities will automatically be created and assigned to this role', 'pods')); ?> </p> <div class="pods-pick-values pods-pick-checkbox"> <ul id="custom-capabilities"> <li class="pods-repeater hidden"> <?php echo PodsForm::field('custom_capabilities[--1]', '', 'text'); ?> </li> <li> <?php echo PodsForm::field('custom_capabilities[0]', '', 'text'); ?> </li> </ul> <p> <a href="#add-capability" id="add-capability" class="button">Add Another Custom Capability</a> </p> </div> </div> </div> </div> </div> <div id="pods-wizard-actions"> <div id="pods-wizard-toolbar">
<p class="pods-field-option-group-label"> <?php _e('Available Taxonomies', 'pods'); ?> </p> <div class="pods-pick-values pods-pick-checkbox"> <ul> <?php foreach ($taxonomies as $taxonomy) { $taxonomy_name = pods_var_raw('name', $taxonomy); $taxonomy_label = pods_var_raw('label', $taxonomy, ucwords(str_replace('_', ' ', $taxonomy_name))); ?> <li> <?php echo PodsForm::field('taxonomy[' . $taxonomy_name . ']', pods_var_raw('taxonomy[' . $taxonomy_name . ']', 'post', true), 'boolean', array('boolean_yes_label' => $taxonomy_label . ' (' . $taxonomy_name . ')')); ?> </li> <?php } ?> </ul> </div> </div> <?php } else { ?> <p class="padded"><?php _e('No Taxonomies were found.', 'pods'); ?> </p>
/** * Return a field input for a specific field * * @param array|string $field Input field name to use (overrides default name) * @param null $input_name * @param mixed $value Current value to use * @param array $options * @param null $pod * @param null $id * * @return string Field Input HTML * * @since 2.3.10 */ public function input($field, $input_name = null, $value = null, $options = array(), $pod = null, $id = null) { // Field data override if (is_array($field)) { $field_data = $field; $field = pods_var_raw('name', $field); } else { $field_data = $this->fields($field); } if (!empty($field_data)) { $field_type = $field_data['type']; if (empty($input_name)) { $input_name = $field; } return PodsForm::field($input_name, $value, $field_type, $field_data, $pod, $id); } return ''; }
<div id="pods-meta-box" class="postbox pods-deploy-ui"> <form action="?page=pods-deploy" method="post"> <div id="icon-tools" class="icon32"><br></div> <h2> <?php _e(sprintf('Pods Deploy: %1s', $key_gen_header), 'pods-deploy'); ?> </h2> <input type="hidden" class="" name="allow-deploy" id="allow-deploy" value="<?php echo !$deploy_active; ?> "> <?php echo PodsForm::field('_wpnonce', wp_create_nonce('pods-deploy'), 'hidden'); ?> <p class="submit"> <input type="submit" class="button button-primary" name="pods-deploy-key-gen-submit" value="<?php echo $key_gen_submit; ?> "> </p> </form> <?php if ($deploy_active) { ?> <div id="current-keys"> <p>
function manage_wp_posts_be_qe_bulk_quick_edit_custom_box($column_name, $post_type) { $post_id = get_the_ID(); switch ($post_type) { case 'mg_task': switch ($column_name) { case 'issue_type': $issue_type = get_post_meta($post_id, 'issue_type', true); $pod = pods('mg_task'); $field = $pod->fields['issue_type']; $pod_field = PodsForm::field("issue_type", $issue_type, 'pick', $field, $pod, $pod->id()); ?> <fieldset class="inline-edit-col-left"> <div class="inline-edit-col"> <label> <span class="title">Issue Type</span> <span class="input-text-wrap"> <?php echo $pod_field; ?> </span> </label> <?php break; case 'priority': $priority = get_post_meta($post_id, 'priority', true); $pod = pods('mg_task'); $field = $pod->fields['priority']; $pod_field = PodsForm::field("priority", $priority, 'pick', $field, $pod, $pod->id()); ?> <label> <span class="title">Priority</span> <span class="input-text-wrap"> <?php echo $pod_field; ?> </span> </label> <?php break; case 'estimated_time': $estimated_time = get_post_meta($post_id, 'estimated_time', true); $pod = pods('mg_task'); $field = $pod->fields['estimated_time']; $pod_field = PodsForm::field("estimated_time", $estimated_time, 'text', $field, $pod, $pod->id()); ?> <label> <span class="title">Estimated Time</span> <span class="input-text-wrap"> <?php echo $pod_field; ?> </span> </label> <?php break; case 'project': $project = get_post_meta($post_id, 'project', true); $pod = pods('mg_task'); $field = $pod->fields['project']; $field['options']['pick_format_style'] = 'dropdown'; $field['options']['pick_format_single'] = 'dropdown'; $pod_field = PodsForm::field("project", $project, 'pick', $field, $pod, $pod->id()); ?> <label> <span class="title">Project</span> <span class="input-text-wrap"> <?php echo $pod_field; ?> </span> </label> </div> </fieldset> <?php $estimates = get_post_meta($post_id, 'add_line_item_to_estimate', false); $invoice_field = $pod->fields['add_line_item_to_estimate']; $estimate_ids = array(); if (!empty($estimates)) { foreach ($estimates as $estimate) { $estimate_ids[] = $estimate['ID']; } } $pod_field = PodsForm::field("add_line_item_to_estimate", $estimate_ids, 'pick', $invoice_field, $pod, $pod->id()); ?> <fieldset class="inline-edit-col-left"> <div class="inline-edit-col"> <label> <span class="title">Estimates</span> <span id="add_line_item_to_estimate" class="input-text-wrap"><?php echo $pod_field; ?> </span> </label> </div> <?php $invoices = get_post_meta($post_id, 'add_line_item_to_invoice', false); $invoice_field = $pod->fields['add_line_item_to_invoice']; $invoice_ids = array(); if (!empty($invoices)) { foreach ($invoices as $invoice) { $invoice_ids[] = $invoice['ID']; } } $pod_field = PodsForm::field("add_line_item_to_invoice", $invoice_ids, 'pick', $invoice_field, $pod, $pod->id()); ?> <fieldset class="inline-edit-col-left"> <div class="inline-edit-col"> <label> <span class="title">Invoices</span> <span id="add_line_item_to_invoice" class="input-text-wrap"><?php echo $pod_field; ?> </span> </label> </div> </fieldset> <?php break; } break; } }
/** * Handle the Import/Export AJAX * * @param $params */ public function ajax_import_export($params) { if ('import' == $params->import_export) { $data = trim($params->import_package); $content = '<div class="pods-wizard-content">'; if (!empty($data)) { $imported = $this->import($data); if (!empty($imported)) { $content .= '<p>Import Complete! The following items were imported:</p>'; foreach ($imported as $type => $import) { $content .= '<h4>' . ucwords($type) . '</h4>'; $content .= '<ul class="normal">'; foreach ($import as $k => $what) { $content .= '<li>' . esc_html($what) . '</li>'; } $content .= '</ul>'; } } } else { $content .= '<p>Import Error: Invalid Package</p>'; } $content .= '</div>'; echo $content; } elseif ('export' == $params->import_export) { $params = get_object_vars($params); foreach ($params as $k => $v) { if (is_array($v)) { $params[$k] = array_keys(array_filter($v)); } } $package = $this->export($params); echo '<div class="pods-field-option">'; echo PodsForm::field('export_package', $package, 'paragraph', array('attributes' => array('style' => 'width: 94%; max-width: 94%; height: 300px;'))); echo '</div>'; } }
* @params object $pod The current Pod object. * @params array $params The form's parameters. * * @since 2.3.19 */ do_action('pods_form_after_field', $field, $fields, $pod, $params); } ?> </ul> <?php foreach ($fields as $field) { if ('hidden' != $field['type']) { continue; } echo PodsForm::field($field_prefix . $field['name'], $pod->field(array('name' => $field['name'], 'in_form' => true)), 'hidden'); } /** * Runs after all fields are outputted. * * @params array $fields Fields of the form * @params object $pod The current Pod object * @params array $params The form's parameters. * * @since 2.3.19 */ do_action('pods_form_after_fields', $fields, $pod, $params); ?> <?php if (!$fields_only) {
/** * @param $comment * @param $metabox */ public function meta_comment($comment, $metabox) { wp_enqueue_style('pods-form'); $hidden_fields = array(); ?> <table class="form-table editcomment pods-metabox"> <?php $id = null; if (is_object($comment)) { $id = $comment->comment_ID; } $pod = pods($metabox['args']['group']['pod']['name'], $id, true); foreach ($metabox['args']['group']['fields'] as $field) { if (false === PodsForm::permission($field['type'], $field['name'], $field, $metabox['args']['group']['fields'], $pod, $id)) { if (pods_var('hidden', $field['options'], false, null, true)) { $field['type'] = 'hidden'; } else { continue; } } elseif (!pods_has_permissions($field['options']) && pods_var('hidden', $field['options'], false, null, true)) { $field['type'] = 'hidden'; } $value = ''; if (!empty($pod)) { $value = $pod->field(array('name' => $field['name'], 'in_form' => true)); } if ('hidden' == $field['type']) { $hidden_fields[] = array('field' => $field, 'value' => $value); } else { ?> <tr class="form-field pods-field <?php echo 'pods-form-ui-row-type-' . $field['type'] . ' pods-form-ui-row-name-' . Podsform::clean($field['name'], true); ?> "> <th scope="row" valign="top"><?php echo PodsForm::label('pods_meta_' . $field['name'], $field['label'], $field['help'], $field); ?> </th> <td> <?php echo PodsForm::field('pods_meta_' . $field['name'], $value, $field['type'], $field, $pod, $id); ?> <?php echo PodsForm::comment('pods_meta_' . $field['name'], $field['description'], $field); ?> </td> </tr> <?php } } ?> </table> <?php foreach ($hidden_fields as $hidden_field) { $field = $hidden_field['field']; echo PodsForm::field('pods_meta_' . $field['name'], $hidden_field['value'], 'hidden'); } }
/** * Return a field input for a specific field * * @param string|array $field Field name or Field data array * @param string $field Input field name to use (overrides default name) * @param mixed $value Current value to use * * @return string Field Input HTML * * @since 2.3.10 */ public function input($field, $input_name = null, $value = '__null') { // Field data override if (is_array($field)) { $field_data = $field; $field = pods_var_raw('name', $field); } else { $field_data = $this->fields($field); } if (!empty($field_data)) { $field_type = pods_var_raw('type', $field_data); if (empty($input_name)) { $input_name = $field; } if ('__null' == $value) { $value = $this->field(array('name' => $field, 'in_form' => true)); } return PodsForm::field($input_name, $value, $field_type, $field_data, $this, $this->id()); } return ''; }
public function filters_popup() { $filters = $this->filters; ?> <div id="pods-ui-posts-filter-popup" class="hidden"> <form action="" method="get" class="pods-ui-posts-filter-popup"> <h2><?php _e('Advanced Filters', 'pods'); ?> </h2> <div class="pods-ui-posts-filters"> <?php $excluded_filters = array('search' . $this->num, 'pg' . $this->num, 'action' . $this->num, 'action_bulk' . $this->num, 'action_bulk_ids' . $this->num, '_wpnonce' . $this->num); foreach ($filters as $filter) { $excluded_filters[] = 'filters_relation'; $excluded_filters[] = 'filters_compare_' . $filter; $excluded_filters[] = 'filter_' . $filter . '_start'; $excluded_filters[] = 'filter_' . $filter . '_end'; $excluded_filters[] = 'filter_' . $filter; } $get = $_GET; foreach ($get as $k => $v) { if (in_array($k, $excluded_filters) || strlen($v) < 1) { continue; } ?> <input type="hidden" name="<?php echo esc_attr($k); ?> " value="<?php echo esc_attr($v); ?> " /> <?php } $zebra = true; foreach ($filters as $filter) { if (empty($filter)) { continue; } if (isset($this->pod->fields[$filter])) { $filter_field = $this->pod->fields[$filter]; } elseif (isset($this->fields['manage'][$filter])) { $filter_field = $this->fields['manage'][$filter]; } else { continue; } ?> <p class="pods-ui-posts-filter-toggled pods-ui-posts-filter-<?php echo esc_attr($filter . ($zebra ? ' clear' : '')); ?> "> <?php if (in_array($filter_field['type'], array('date', 'datetime', 'time'))) { $start = pods_var_raw('filter_' . $filter . '_start', 'get', pods_var_raw('filter_default', $filter_field, '', null, true), null, true); $end = pods_var_raw('filter_' . $filter . '_end', 'get', pods_var_raw('filter_ongoing_default', $filter_field, '', null, true), null, true); // override default value $filter_field['options']['default_value'] = ''; $filter_field['options'][$filter_field['type'] . '_allow_empty'] = 1; if (!empty($start) && !in_array($start, array('0000-00-00', '0000-00-00 00:00:00', '00:00:00'))) { $start = PodsForm::field_method($filter_field['type'], 'convert_date', $start, 'n/j/Y'); } if (!empty($end) && !in_array($end, array('0000-00-00', '0000-00-00 00:00:00', '00:00:00'))) { $end = PodsForm::field_method($filter_field['type'], 'convert_date', $end, 'n/j/Y'); } ?> <span class="pods-ui-posts-filter-toggle toggle-on<?php echo esc_attr(empty($start) && empty($end) ? '' : ' hidden'); ?> ">+</span> <span class="pods-ui-posts-filter-toggle toggle-off<?php echo esc_attr(empty($start) && empty($end) ? ' hidden' : ''); ?> "><?php _e('Clear', 'pods'); ?> </span> <label for="pods-form-ui-filter-<?php echo esc_attr($filter); ?> _start"> <?php echo $filter_field['label']; ?> </label> <span class="pods-ui-posts-filter<?php echo esc_attr(empty($start) && empty($end) ? ' hidden' : ''); ?> "> <?php echo PodsForm::field('filter_' . $filter . '_start', $start, $filter_field['type'], $filter_field); ?> <label for="pods-form-ui-filter-<?php echo esc_attr($filter); ?> _end">to</label> <?php echo PodsForm::field('filter_' . $filter . '_end', $end, $filter_field['type'], $filter_field); ?> </span> <?php } elseif ('pick' == $filter_field['type']) { $value = pods_var_raw('filter_' . $filter, 'get', ''); if (strlen($value) < 1) { $value = pods_var_raw('filter_default', $filter_field); } // override default value $filter_field['options']['default_value'] = ''; $filter_field['options']['pick_format_type'] = 'single'; $filter_field['options']['pick_format_single'] = 'dropdown'; $filter_field['options']['input_helper'] = pods_var_raw('ui_input_helper', pods_var_raw('options', pods_var_raw($filter, $this->fields['search'], array(), null, true), array(), null, true), '', null, true); $filter_field['options']['input_helper'] = pods_var_raw('ui_input_helper', $filter_field['options'], $filter_field['options']['input_helper'], null, true); $options = array_merge($filter_field, $filter_field['options']); ?> <span class="pods-ui-posts-filter-toggle toggle-on<?php echo esc_attr(empty($value) ? '' : ' hidden'); ?> ">+</span> <span class="pods-ui-posts-filter-toggle toggle-off<?php echo esc_attr(empty($value) ? ' hidden' : ''); ?> "><?php _e('Clear', 'pods'); ?> </span> <label for="pods-form-ui-filter-<?php echo esc_attr($filter); ?> "> <?php echo $filter_field['label']; ?> </label> <span class="pods-ui-posts-filter<?php echo esc_attr(strlen($value) < 1 ? ' hidden' : ''); ?> "> <?php echo PodsForm::field('filter_' . $filter, $value, 'pick', $options); ?> </span> <?php } elseif ('boolean' == $filter_field['type']) { $value = pods_var_raw('filter_' . $filter, 'get', ''); if (strlen($value) < 1) { $value = pods_var_raw('filter_default', $filter_field); } // override default value $filter_field['options']['default_value'] = ''; $filter_field['options']['pick_format_type'] = 'single'; $filter_field['options']['pick_format_single'] = 'dropdown'; $filter_field['options']['pick_object'] = 'custom-simple'; $filter_field['options']['pick_custom'] = array('1' => pods_var_raw('boolean_yes_label', $filter_field['options'], __('Yes', 'pods'), null, true), '0' => pods_var_raw('boolean_no_label', $filter_field['options'], __('No', 'pods'), null, true)); $filter_field['options']['input_helper'] = pods_var_raw('ui_input_helper', pods_var_raw('options', pods_var_raw($filter, $this->fields['search'], array(), null, true), array(), null, true), '', null, true); $filter_field['options']['input_helper'] = pods_var_raw('ui_input_helper', $filter_field['options'], $filter_field['options']['input_helper'], null, true); $options = array_merge($filter_field, $filter_field['options']); ?> <span class="pods-ui-posts-filter-toggle toggle-on<?php echo esc_attr(empty($value) ? '' : ' hidden'); ?> ">+</span> <span class="pods-ui-posts-filter-toggle toggle-off<?php echo esc_attr(empty($value) ? ' hidden' : ''); ?> "><?php _e('Clear', 'pods'); ?> </span> <label for="pods-form-ui-filter-<?php echo esc_attr($filter); ?> "> <?php echo $filter_field['label']; ?> </label> <span class="pods-ui-posts-filter<?php echo esc_attr(strlen($value) < 1 ? ' hidden' : ''); ?> "> <?php echo PodsForm::field('filter_' . $filter, $value, 'pick', $options); ?> </span> <?php } else { $value = pods_var_raw('filter_' . $filter, 'get'); if (strlen($value) < 1) { $value = pods_var_raw('filter_default', $filter_field); } $options = array('input_helper' => pods_var_raw('ui_input_helper', pods_var_raw('options', pods_var_raw($filter, $this->fields['search'], array(), null, true), array(), null, true), '', null, true)); if (empty($options['input_helper']) && isset($filter_field['options']) && isset($filter_field['options']['input_helper'])) { $options['input_helper'] = $filter_field['options']['input_helper']; } ?> <span class="pods-ui-posts-filter-toggle toggle-on<?php echo esc_attr(empty($value) ? '' : ' hidden'); ?> ">+</span> <span class="pods-ui-posts-filter-toggle toggle-off<?php echo esc_attr(empty($value) ? ' hidden' : ''); ?> "><?php _e('Clear', 'pods'); ?> </span> <label for="pods-form-ui-filter-<?php echo esc_attr($filter); ?> "> <?php echo $filter_field['label']; ?> </label> <span class="pods-ui-posts-filter<?php echo esc_attr(empty($value) ? ' hidden' : ''); ?> "> <?php echo PodsForm::field('filter_' . $filter, $value, 'text', $options); ?> </span> <?php } ?> </p> <?php $zebra = empty($zebra); } ?> <p class="pods-ui-posts-filter-toggled pods-ui-posts-filter-search<?php echo esc_attr($zebra ? ' clear' : ''); ?> "> <label for="pods-form-ui-search<?php echo esc_attr($this->num); ?> "><?php _e('Search Text', 'pods'); ?> </label> <?php echo PodsForm::field('search' . $this->num, pods_var_raw('search' . $this->num, 'get'), 'text'); ?> </p> <?php $zebra = empty($zebra); ?> </div> <p class="submit<?php echo esc_attr($zebra ? ' clear' : ''); ?> "><input type="submit" value="<?php echo esc_attr($this->header['search']); ?> " class="button button-primary" /></p> </form> </div> <script type="text/javascript"> jQuery( function () { jQuery( document ).on( 'click', '.pods-ui-posts-filter-toggle.toggle-on', function ( e ) { jQuery( this ).parent().find( '.pods-ui-posts-filter' ).removeClass( 'hidden' ); jQuery( this ).hide(); jQuery( this ).parent().find( '.toggle-off' ).show(); } ); jQuery( document ).on( 'click', '.pods-ui-posts-filter-toggle.toggle-off', function ( e ) { jQuery( this ).parent().find( '.pods-ui-posts-filter' ).addClass( 'hidden' ); jQuery( this ).parent().find( 'select, input' ).val( '' ); jQuery( this ).hide(); jQuery( this ).parent().find( '.toggle-on' ).show(); } ); jQuery( document ).on( 'click', '.pods-ui-posts-filter-toggled label', function ( e ) { if ( jQuery( this ).parent().find( '.pods-ui-posts-filter' ).hasClass( 'hidden' ) ) { jQuery( this ).parent().find( '.pods-ui-posts-filter' ).removeClass( 'hidden' ); jQuery( this ).parent().find( '.toggle-on' ).hide(); jQuery( this ).parent().find( '.toggle-off' ).show(); } else { jQuery( this ).parent().find( '.pods-ui-posts-filter' ).addClass( 'hidden' ); jQuery( this ).parent().find( 'select, input' ).val( '' ); jQuery( this ).parent().find( '.toggle-on' ).show(); jQuery( this ).parent().find( '.toggle-off' ).hide(); } } ); } ); </script> <?php }
/** * Handle file row output for uploaders * * @param array $attributes * @param int $limit * @param bool $editable * @param int $id * @param string $icon * @param string $name * * @return string * @since 2.0 */ public function markup($attributes, $limit = 1, $editable = true, $id = null, $icon = null, $name = null) { // Preserve current file type $field_type = PodsForm::$field_type; ob_start(); if (empty($id)) { $id = '{{id}}'; } if (empty($icon)) { $icon = '{{icon}}'; } if (empty($name)) { $name = '{{name}}'; } $editable = (bool) $editable; ?> <li class="pods-file hidden" id="pods-file-<?php echo $id; ?> "> <?php echo PodsForm::field($attributes['name'] . '[' . $id . '][id]', $id, 'hidden'); ?> <ul class="pods-file-meta media-item"> <?php if (1 != $limit) { ?> <li class="pods-file-col pods-file-handle">Handle</li> <?php } ?> <li class="pods-file-col pods-file-icon"> <img class="pinkynail" src="<?php echo $icon; ?> " alt="Icon" /> </li> <li class="pods-file-col pods-file-name"> <?php if ($editable) { echo PodsForm::field($attributes['name'] . '[' . $id . '][title]', $name, 'text'); } else { echo empty($name) ? '{{name}}' : $name; } ?> </li> <li class="pods-file-col pods-file-delete">Delete</li> </ul> </li> <?php PodsForm::$field_type = $field_type; return ob_get_clean(); }
} var pods_sister_field_going = { }; var pods_sister_field = function ( $el ) { var id = $el.closest( 'tr.pods-manage-row' ).data( 'row' ); if ( 'undefined' != typeof pods_sister_field_going[ id + '_' + $el.prop( 'id' ) ] && true == pods_sister_field_going[ id + '_' + $el.prop( 'id' ) ] ) return; pods_sister_field_going[ id + '_' + $el.prop( 'id' ) ] = true; var default_select = '<?php echo str_replace(array("\n", "\r"), ' ', PodsForm::field('field_data[--1][sister_id]', '', 'pick', array('data' => pods_var_raw('sister_id', $field_settings)))); ?> '; default_select = default_select.replace( /\-\-1/g, id ); var related_pod_name = jQuery( '#pods-form-ui-field-data-' + id + '-pick-object' ).val(); if ( 0 != related_pod_name.indexOf( 'pod-' ) && 0 != related_pod_name.indexOf( 'post_type-' ) && 0 != related_pod_name.indexOf( 'taxonomy-' ) && 0 != related_pod_name.indexOf( 'user' ) && 0 != related_pod_name.indexOf( 'media' ) && 0 != related_pod_name.indexOf( 'comment' ) ) { pods_sister_field_going[ id + '_' + $el.prop( 'id' ) ] = false; return; } var selected_value = jQuery( '#pods-form-ui-field-data-' + id + '-sister-id' ).val(); var select_container = default_select.match( /<select[^<]*>/g );
<?php echo PodsForm::label($name, $options); ?> <?php echo PodsForm::field($name, $value, $type, $options, $pod, $id); ?> <?php echo PodsForm::comment($name, null, $options);