当前位置: 首页>>代码示例>>PHP>>正文


PHP PodsForm::field_setup方法代码示例

本文整理汇总了PHP中PodsForm::field_setup方法的典型用法代码示例。如果您正苦于以下问题:PHP PodsForm::field_setup方法的具体用法?PHP PodsForm::field_setup怎么用?PHP PodsForm::field_setup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PodsForm的用法示例。


在下文中一共展示了PodsForm::field_setup方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: load_pod


//.........这里部分代码省略.........
                 $pod = array('id' => 0, 'name' => $params->name, 'label' => __('Pods', 'pods'), 'type' => 'post_type', 'storage' => 'meta', 'options' => array('label_singular' => __('Pod', 'pods')), 'fields' => array());
             } elseif ('_pods_field' == $params->name) {
                 $pod = array('id' => 0, 'name' => $params->name, 'label' => __('Pod Fields', 'pods'), 'type' => 'post_type', 'storage' => 'meta', 'options' => array('label_singular' => __('Pod Field', 'pods')), 'fields' => array());
             } elseif (pods_api_cache()) {
                 $pod = pods_transient_get($transient . '_' . $params->name);
             }
             if (false !== $pod && (!$table_info || isset($pod['table']))) {
                 if (in_array($pod['type'], array('post_type', 'taxonomy')) && is_object($sitepress) && !$icl_adjust_id_url_filter_off) {
                     $pod = array_merge($pod, $this->get_table_info($pod['type'], $pod['object'], $pod['name'], $pod));
                 }
                 return $pod;
             }
         }
         if (!isset($params->name)) {
             $pod = get_post($dummy = (int) $params->id);
         } else {
             $pod = get_posts(array('name' => $params->name, 'post_type' => '_pods_pod', 'posts_per_page' => 1));
         }
         if (empty($pod)) {
             if ($strict) {
                 return pods_error(__('Pod not found', 'pods'), $this);
             }
             return false;
         }
         if (is_array($pod)) {
             $pod = $pod[0];
         }
         $_pod = get_object_vars($pod);
     }
     $pod = false;
     if (pods_api_cache()) {
         $pod = pods_transient_get($transient . '_' . $_pod['post_name']);
     }
     if (false !== $pod && (!$table_info || isset($pod['table']))) {
         if (in_array($pod['type'], array('post_type', 'taxonomy')) && is_object($sitepress) && !$icl_adjust_id_url_filter_off) {
             $pod = array_merge($pod, $this->get_table_info($pod['type'], $pod['object'], $pod['name'], $pod));
         }
         return $pod;
     }
     $pod = array('id' => $_pod['ID'], 'name' => $_pod['post_name'], 'label' => $_pod['post_title'], 'description' => $_pod['post_content']);
     if (strlen($pod['label']) < 1) {
         $pod['label'] = $pod['name'];
     }
     // @todo update with a method to put all options in
     $defaults = array('show_in_menu' => 1, 'type' => 'post_type', 'storage' => 'meta', 'object' => '', 'alias' => '');
     $pod['options'] = get_post_meta($pod['id']);
     foreach ($pod['options'] as $option => $value) {
         if (is_array($value)) {
             foreach ($value as $k => $v) {
                 if (!is_array($v)) {
                     $value[$k] = maybe_unserialize($v);
                 }
             }
             if (1 == count($value)) {
                 $value = current($value);
             }
         } else {
             $value = maybe_unserialize($value);
         }
         $pod['options'][$option] = $value;
     }
     $pod['options'] = array_merge($defaults, $pod['options']);
     $pod['type'] = $pod['options']['type'];
     $pod['storage'] = $pod['options']['storage'];
     $pod['object'] = $pod['options']['object'];
     $pod['alias'] = $pod['options']['alias'];
     unset($pod['options']['type']);
     unset($pod['options']['storage']);
     unset($pod['options']['object']);
     unset($pod['options']['alias']);
     if ($table_info) {
         $pod = array_merge($this->get_table_info($pod['type'], $pod['object'], $pod['name'], $pod), $pod);
     }
     if (isset($pod['pod'])) {
         unset($pod['pod']);
     }
     $pod['fields'] = array();
     $pod['object_fields'] = array();
     if ('pod' != $pod['type']) {
         $pod['object_fields'] = $this->get_wp_object_fields($pod['type'], $pod);
     }
     $fields = get_posts(array('post_type' => '_pods_field', 'posts_per_page' => -1, 'nopaging' => true, 'post_parent' => $pod['id'], 'orderby' => 'menu_order', 'order' => 'ASC'));
     if (!empty($fields)) {
         foreach ($fields as $field) {
             $field->pod = $pod['name'];
             $field->table_info = $table_info;
             if ($load_fields) {
                 $field = $this->load_field($field);
                 $field = PodsForm::field_setup($field, null, $field['type']);
             } else {
                 $field = array('id' => $field->ID, 'name' => $field->post_name, 'label' => $field->post_title, 'type' => get_post_meta($field->ID, 'type', true));
             }
             $pod['fields'][$field['name']] = $field;
         }
     }
     if (did_action('init') && pods_api_cache()) {
         pods_transient_set($transient . '_' . $pod['name'], $pod);
     }
     return $pod;
 }
开发者ID:satokora,项目名称:IT354Project,代码行数:101,代码来源:PodsAPI.php

示例2: admin_ajax_settings

 public function admin_ajax_settings($component, $params)
 {
     if (!isset($this->components[$component])) {
         wp_die('Invalid Component');
     } elseif (!method_exists($this->components[$component]['object'], 'options')) {
         pods_error('Component options method does not exist', $this);
     }
     $options = $this->components[$component]['object']->options($this->settings['components'][$component]);
     if (empty($this->settings['components'][$component])) {
         $this->settings['components'][$component] = array();
     }
     foreach ($options as $field_name => $field_option) {
         $field_option = PodsForm::field_setup($field_option, null, $field_option['type']);
         if (!is_array($field_option['group'])) {
             $field_value = pods_var_raw('pods_setting_' . $field_name, $params);
             $this->settings['components'][$component][$field_name] = $field_value;
         } else {
             foreach ($field_option['group'] as $field_group_name => $field_group_option) {
                 $field_value = pods_var_raw('pods_setting_' . $field_group_name, $params);
                 $this->settings['components'][$component][$field_group_name] = $field_value;
             }
         }
     }
     $settings = version_compare(PHP_VERSION, '5.4.0', '>=') ? json_encode($this->settings, JSON_UNESCAPED_UNICODE) : json_encode($this->settings);
     update_option('pods_component_settings', $settings);
     return '1';
 }
开发者ID:Ingenex,项目名称:redesign,代码行数:27,代码来源:PodsComponents.php

示例3: setup_fields


//.........这里部分代码省略.........
             if (false === $attributes['options']['filter'] || !isset($attributes['date_ongoing']) || 'date' != $attributes['type'] || !in_array($field, $this->filters)) {
                 $attributes['date_ongoing'] = false;
             }
             if (false === $attributes['options']['filter'] || !isset($attributes['date_ongoing']) || 'date' != $attributes['type'] || !isset($attributes['date_ongoing_default']) || !in_array($field, $this->filters)) {
                 $attributes['date_ongoing_default'] = false;
             }
             if (!isset($attributes['export'])) {
                 $attributes['export'] = true;
             }
             if (!isset($attributes['group_related'])) {
                 $attributes['group_related'] = false;
             }
             if (!isset($attributes['comments'])) {
                 $attributes['comments'] = '';
             }
             if (!isset($attributes['comments_top'])) {
                 $attributes['comments_top'] = false;
             }
             if (!isset($attributes['custom_view'])) {
                 $attributes['custom_view'] = false;
             }
             if (!isset($attributes['custom_input'])) {
                 $attributes['custom_input'] = false;
             }
             if (isset($attributes['display_helper'])) {
                 // pods ui backward compatibility
                 $attributes['custom_display'] = $attributes['display_helper'];
             }
             if (!isset($attributes['custom_display'])) {
                 $attributes['custom_display'] = false;
             }
             if (!isset($attributes['custom_relate'])) {
                 $attributes['custom_relate'] = false;
             }
             if (!isset($attributes['custom_form_display'])) {
                 $attributes['custom_form_display'] = false;
             }
             if (!isset($attributes['css_values'])) {
                 $attributes['css_values'] = true;
             }
             if ('search_columns' == $which && !$attributes['options']['search']) {
                 continue;
             }
             $attributes = PodsForm::field_setup($attributes, null, $attributes['type']);
             $new_fields[$field] = $attributes;
         }
         $fields = $new_fields;
     }
     if (false !== $init) {
         if ('fields' != $which && !empty($this->fields)) {
             $this->fields = $this->setup_fields($this->fields, 'fields');
         } else {
             $this->fields['manage'] = $fields;
         }
         if (!in_array('add', $this->actions_disabled) || !in_array('edit', $this->actions_disabled) || !in_array('duplicate', $this->actions_disabled)) {
             if ('form' != $which && isset($this->fields['form']) && is_array($this->fields['form'])) {
                 $this->fields['form'] = $this->setup_fields($this->fields['form'], 'form');
             } else {
                 $this->fields['form'] = $fields;
             }
             if (!in_array('add', $this->actions_disabled)) {
                 if ('add' != $which && isset($this->fields['add']) && is_array($this->fields['add'])) {
                     $this->fields['add'] = $this->setup_fields($this->fields['add'], 'add');
                 }
             }
             if (!in_array('edit', $this->actions_disabled)) {
                 if ('edit' != $which && isset($this->fields['edit']) && is_array($this->fields['edit'])) {
                     $this->fields['edit'] = $this->setup_fields($this->fields['edit'], 'edit');
                 }
             }
             if (!in_array('duplicate', $this->actions_disabled)) {
                 if ('duplicate' != $which && isset($this->fields['duplicate']) && is_array($this->fields['duplicate'])) {
                     $this->fields['duplicate'] = $this->setup_fields($this->fields['duplicate'], 'duplicate');
                 }
             }
         }
         if (false !== $this->searchable) {
             if ('search' != $which && isset($this->fields['search']) && !empty($this->fields['search'])) {
                 $this->fields['search'] = $this->setup_fields($this->fields['search'], 'search');
             } else {
                 $this->fields['search'] = $fields;
             }
         } else {
             $this->fields['search'] = false;
         }
         if (!in_array('export', $this->actions_disabled)) {
             if ('export' != $which && isset($this->fields['export']) && !empty($this->fields['export'])) {
                 $this->fields['export'] = $this->setup_fields($this->fields['export'], 'export');
             }
         }
         if (!in_array('reorder', $this->actions_disabled) && false !== $this->reorder['on']) {
             if ('reorder' != $which && isset($this->fields['reorder']) && !empty($this->fields['reorder'])) {
                 $this->fields['reorder'] = $this->setup_fields($this->fields['reorder'], 'reorder');
             } else {
                 $this->fields['reorder'] = $fields;
             }
         }
     }
     return $this->do_hook('setup_fields', $fields, $which, $init);
 }
开发者ID:dylansmithing,项目名称:leader-of-rock-wordpress,代码行数:101,代码来源:PodsUI.php

示例4: traverse_recurse

 /**
  * Recursively join tables based on fields
  *
  * @param array $traverse_recurse Array of traversal options
  *
  * @return array Array of table joins
  *
  * @since 2.0
  */
 function traverse_recurse($traverse_recurse)
 {
     global $wpdb;
     $defaults = array('pod' => null, 'fields' => array(), 'joined' => 't', 'depth' => 0, 'joined_id' => 'id', 'joined_index' => 'id', 'params' => new stdClass(), 'last_table_info' => array());
     $traverse_recurse = array_merge($defaults, $traverse_recurse);
     $joins = array();
     if (0 == $traverse_recurse['depth'] && !empty($traverse_recurse['pod']) && !empty($traverse_recurse['last_table_info']) && isset($traverse_recurse['last_table_info']['id'])) {
         $pod_data = $traverse_recurse['last_table_info'];
     } elseif (empty($traverse_recurse['pod'])) {
         if (!empty($traverse_recurse['params']) && !empty($traverse_recurse['params']->table) && 0 === strpos($traverse_recurse['params']->table, $wpdb->prefix)) {
             if ($wpdb->posts == $traverse_recurse['params']->table) {
                 $traverse_recurse['pod'] = 'post_type';
             } elseif ($wpdb->terms == $traverse_recurse['params']->table) {
                 $traverse_recurse['pod'] = 'taxonomy';
             } elseif ($wpdb->users == $traverse_recurse['params']->table) {
                 $traverse_recurse['pod'] = 'user';
             } elseif ($wpdb->comments == $traverse_recurse['params']->table) {
                 $traverse_recurse['pod'] = 'comment';
             } else {
                 return $joins;
             }
             $pod_data = array();
             if (in_array($traverse_recurse['pod'], array('user', 'comment'))) {
                 $pod = $this->api->load_pod(array('name' => $traverse_recurse['pod'], 'table_info' => true));
                 if (!empty($pod) && $pod['type'] == $pod) {
                     $pod_data = $pod;
                 }
             }
             if (empty($pod_data)) {
                 $pod_data = array('id' => 0, 'name' => '_table_' . $traverse_recurse['pod'], 'type' => $traverse_recurse['pod'], 'storage' => 'taxonomy' == $traverse_recurse['pod'] ? 'none' : 'meta', 'fields' => array(), 'object_fields' => $this->api->get_wp_object_fields($traverse_recurse['pod']));
                 $pod_data = array_merge($this->api->get_table_info($traverse_recurse['pod'], ''), $pod_data);
             }
             $traverse_recurse['pod'] = $pod_data['name'];
         } else {
             return $joins;
         }
     } else {
         $pod_data = $this->api->load_pod(array('name' => $traverse_recurse['pod'], 'table_info' => true), false);
         if (empty($pod_data)) {
             return $joins;
         }
     }
     if (isset($pod_data['object_fields'])) {
         $pod_data['fields'] = array_merge($pod_data['fields'], $pod_data['object_fields']);
     }
     $tableless_field_types = PodsForm::tableless_field_types();
     $simple_tableless_objects = PodsForm::field_method('pick', 'simple_objects');
     $file_field_types = PodsForm::file_field_types();
     if (!isset($this->traversal[$traverse_recurse['pod']])) {
         $this->traversal[$traverse_recurse['pod']] = array();
     }
     if ((empty($pod_data['meta_table']) || $pod_data['meta_table'] == $pod_data['table']) && (empty($traverse_recurse['fields']) || !isset($traverse_recurse['fields'][$traverse_recurse['depth']]) || empty($traverse_recurse['fields'][$traverse_recurse['depth']]))) {
         return $joins;
     }
     $field = $traverse_recurse['fields'][$traverse_recurse['depth']];
     $ignore_aliases = array('wpml_languages', 'polylang_languages');
     $ignore_aliases = $this->do_hook('traverse_recurse_ignore_aliases', $ignore_aliases, $field, $traverse_recurse);
     if (in_array($field, $ignore_aliases)) {
         return $joins;
     }
     $meta_data_table = false;
     if (!isset($pod_data['fields'][$field]) && 'd' == $field && isset($traverse_recurse['fields'][$traverse_recurse['depth'] - 1])) {
         $field = $traverse_recurse['fields'][$traverse_recurse['depth'] - 1];
         $field_type = 'pick';
         if (isset($traverse_recurse['last_table_info']['pod']['fields'][$field])) {
             $field_type = $traverse_recurse['last_table_info']['pod']['fields'][$field]['type'];
         } elseif (isset($traverse_recurse['last_table_info']['pod']['object_fields'][$field])) {
             $field_type = $traverse_recurse['last_table_info']['pod']['object_fields'][$field]['type'];
         }
         $pod_data['fields'][$field] = array('id' => 0, 'name' => $field, 'type' => $field_type, 'pick_object' => $traverse_recurse['last_table_info']['pod']['type'], 'pick_val' => $traverse_recurse['last_table_info']['pod']['name']);
         $meta_data_table = true;
     }
     // Fallback to meta table if the pod type supports it
     if (!isset($pod_data['fields'][$field])) {
         $last = end($traverse_recurse['fields']);
         if ('post_type' == $pod_data['type'] && !isset($pod_data['object_fields'])) {
             $pod_data['object_fields'] = $this->api->get_wp_object_fields('post_type', $pod_data);
         }
         if ('post_type' == $pod_data['type'] && isset($pod_data['object_fields'][$field]) && in_array($pod_data['object_fields'][$field]['type'], $tableless_field_types)) {
             $pod_data['fields'][$field] = $pod_data['object_fields'][$field];
         } elseif (in_array($pod_data['type'], array('post_type', 'media', 'user', 'comment')) && 'meta_value' == $last) {
             $pod_data['fields'][$field] = PodsForm::field_setup(array('name' => $field));
         } else {
             if ('post_type' == $pod_data['type']) {
                 $pod_data['object_fields'] = $this->api->get_wp_object_fields('post_type', $pod_data, true);
                 if ('post_type' == $pod_data['type'] && isset($pod_data['object_fields'][$field]) && in_array($pod_data['object_fields'][$field]['type'], $tableless_field_types)) {
                     $pod_data['fields'][$field] = $pod_data['object_fields'][$field];
                 } else {
                     return $joins;
                 }
             } else {
//.........这里部分代码省略.........
开发者ID:Ingenex,项目名称:redesign,代码行数:101,代码来源:PodsData.php

示例5: foreach

    } else {
        ?>
                    <tr valign="top" class="pods-field-option-group" id="pods-setting-<?php 
        echo $field_name;
        ?>
">
                        <th class="pods-field-option-group-label">
                            <?php 
        echo $field_option['label'];
        ?>
                        </th>
                        <td class="pods-pick-values pods-pick-checkbox">
                            <ul>
                                <?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>
开发者ID:satokora,项目名称:IT354Project,代码行数:31,代码来源:components-admin.php

示例6: ui

 /**
  *
  * Generate UI for Data Management
  *
  * @param mixed $options Array or String containing Pod or Options to be used
  * @param bool $amend Whether to amend the default UI options or replace entirely
  *
  * @return PodsUI|void UI object or void if custom UI used
  *
  * @since 2.3.10
  */
 public function ui($options = null, $amend = false)
 {
     $num = '';
     if (empty($options)) {
         $options = array();
     } else {
         $num = pods_var('num', $options, '');
         if (empty($num)) {
             $num = '';
         }
     }
     if ($this->id() != pods_var('id' . $num, 'get', null, null, true)) {
         $this->fetch(pods_var('id' . $num, 'get', null, null, true));
     }
     if (!empty($options) && !$amend) {
         $this->ui = $options;
         return pods_ui($this);
     } elseif (!empty($options) || 'custom' != pods_var('ui_style', $this->pod_data['options'], 'post_type', null, true)) {
         $actions_enabled = pods_var_raw('ui_actions_enabled', $this->pod_data['options']);
         if (!empty($actions_enabled)) {
             $actions_enabled = (array) $actions_enabled;
         } else {
             $actions_enabled = array();
         }
         $available_actions = array('add', 'edit', 'duplicate', 'delete', 'reorder', 'export');
         if (!empty($actions_enabled)) {
             $actions_disabled = array('view' => 'view');
             foreach ($available_actions as $action) {
                 if (!in_array($action, $actions_enabled)) {
                     $actions_disabled[$action] = $action;
                 }
             }
         } else {
             $actions_disabled = array('duplicate' => 'duplicate', 'view' => 'view', 'export' => 'export');
             if (1 == pods_var('ui_export', $this->pod_data['options'], 0)) {
                 unset($actions_disabled['export']);
             }
         }
         if (empty($options)) {
             $author_restrict = false;
             if (isset($this->fields['author']) && 'pick' == $this->fields['author']['type'] && 'user' == $this->fields['author']['pick_object']) {
                 $author_restrict = 'author.ID';
             }
             if (!pods_is_admin(array('pods', 'pods_content'))) {
                 if (!current_user_can('pods_add_' . $this->pod)) {
                     $actions_disabled['add'] = 'add';
                     if ('add' == pods_var('action' . $num, 'get')) {
                         $_GET['action' . $num] = 'manage';
                     }
                 }
                 if (!$author_restrict && !current_user_can('pods_edit_' . $this->pod) && !current_user_can('pods_edit_others_' . $this->pod)) {
                     $actions_disabled['edit'] = 'edit';
                 }
                 if (!$author_restrict && !current_user_can('pods_delete_' . $this->pod) && !current_user_can('pods_delete_others_' . $this->pod)) {
                     $actions_disabled['delete'] = 'delete';
                 }
                 if (!current_user_can('pods_reorder_' . $this->pod)) {
                     $actions_disabled['reorder'] = 'reorder';
                 }
                 if (!current_user_can('pods_export_' . $this->pod)) {
                     $actions_disabled['export'] = 'export';
                 }
             }
         }
         $_GET['action' . $num] = pods_var('action' . $num, 'get', pods_var('action', $options, 'manage'));
         $index = $this->pod_data['field_id'];
         $label = __('ID', 'pods');
         if (isset($this->pod_data['fields'][$this->pod_data['field_index']])) {
             $index = $this->pod_data['field_index'];
             $label = $this->pod_data['fields'][$this->pod_data['field_index']];
         }
         $manage = array($index => $label);
         if (isset($this->pod_data['fields']['modified'])) {
             $manage['modified'] = $this->pod_data['fields']['modified']['label'];
         }
         $manage_fields = pods_var_raw('ui_fields_manage', $this->pod_data['options']);
         if (!empty($manage_fields)) {
             $manage_new = array();
             foreach ($manage_fields as $manage_field) {
                 if (isset($this->pod_data['fields'][$manage_field])) {
                     $manage_new[$manage_field] = $this->pod_data['fields'][$manage_field];
                 } elseif (isset($this->pod_data['object_fields'][$manage_field])) {
                     $manage_new[$manage_field] = $this->pod_data['object_fields'][$manage_field];
                 } elseif ($manage_field == $this->pod_data['field_id']) {
                     $field = array('name' => $manage_field, 'label' => 'ID', 'type' => 'number', 'width' => '8%');
                     $manage_new[$manage_field] = PodsForm::field_setup($field, null, $field['type']);
                 }
             }
             if (!empty($manage_new)) {
//.........这里部分代码省略.........
开发者ID:erkmen,项目名称:wpstartersetup,代码行数:101,代码来源:Pods.php

示例7: admin_content

 /**
  * Create PodsUI content for the administration pages
  */
 public function admin_content()
 {
     $pod_name = str_replace(array('pods-manage-', 'pods-add-new-'), '', $_GET['page']);
     $pod = pods($pod_name, pods_var('id', 'get', null, null, true));
     $default = 'manage';
     if (false !== strpos($_GET['page'], 'pods-add-new-')) {
         $default = 'add';
     }
     $actions_enabled = pods_var_raw('ui_actions_enabled', $pod->pod_data['options']);
     if (!empty($actions_enabled)) {
         $actions_enabled = (array) $actions_enabled;
     } else {
         $actions_enabled = array();
     }
     $available_actions = array('add', 'edit', 'duplicate', 'delete', 'reorder', 'export');
     if (!empty($actions_enabled)) {
         $actions_disabled = array('view' => 'view');
         foreach ($available_actions as $action) {
             if (!in_array($action, $actions_enabled)) {
                 $actions_disabled[$action] = $action;
             }
         }
     } else {
         $actions_disabled = array('duplicate' => 'duplicate', 'view' => 'view', 'export' => 'export');
         if (1 == pods_var('ui_export', $pod->pod_data['options'], 0)) {
             unset($actions_disabled['export']);
         }
     }
     $author_restrict = false;
     if (isset($pod->fields['author']) && 'pick' == $pod->fields['author']['type'] && 'user' == $pod->fields['author']['pick_object']) {
         $author_restrict = 'author.ID';
     }
     if (!pods_is_admin(array('pods', 'pods_content'))) {
         if (!current_user_can('pods_add_' . $pod_name)) {
             $actions_disabled['add'] = 'add';
             $default = 'manage';
         }
         if (!$author_restrict && !current_user_can('pods_edit_' . $pod_name) && !current_user_can('pods_edit_others_' . $pod_name)) {
             $actions_disabled['edit'] = 'edit';
         }
         if (!$author_restrict && !current_user_can('pods_delete_' . $pod_name) && !current_user_can('pods_delete_others_' . $pod_name)) {
             $actions_disabled['delete'] = 'delete';
         }
         if (!current_user_can('pods_reorder_' . $pod_name)) {
             $actions_disabled['reorder'] = 'reorder';
         }
         if (!current_user_can('pods_export_' . $pod_name)) {
             $actions_disabled['export'] = 'export';
         }
     }
     $_GET['action'] = pods_var('action', 'get', $default);
     $index = $pod->pod_data['field_id'];
     $label = __('ID', 'pods');
     if (isset($pod->pod_data['fields'][$pod->pod_data['field_index']])) {
         $index = $pod->pod_data['field_index'];
         $label = $pod->pod_data['fields'][$pod->pod_data['field_index']];
     }
     $manage = array($index => $label);
     if (isset($pod->pod_data['fields']['modified'])) {
         $manage['modified'] = $pod->pod_data['fields']['modified']['label'];
     }
     $manage_fields = pods_var_raw('ui_fields_manage', $pod->pod_data['options']);
     if (!empty($manage_fields)) {
         $manage_new = array();
         foreach ($manage_fields as $manage_field) {
             if (isset($pod->pod_data['fields'][$manage_field])) {
                 $manage_new[$manage_field] = $pod->pod_data['fields'][$manage_field];
             } elseif (isset($pod->pod_data['object_fields'][$manage_field])) {
                 $manage_new[$manage_field] = $pod->pod_data['object_fields'][$manage_field];
             } elseif ($manage_field == $pod->pod_data['field_id']) {
                 $field = array('name' => $manage_field, 'label' => 'ID', 'type' => 'number', 'width' => '8%');
                 $manage_new[$manage_field] = PodsForm::field_setup($field, null, $field['type']);
             }
         }
         if (!empty($manage_new)) {
             $manage = $manage_new;
         }
     }
     $manage = apply_filters('pods_admin_ui_fields_' . $pod->pod, apply_filters('pods_admin_ui_fields', $manage, $pod->pod, $pod), $pod->pod, $pod);
     $icon = pods_var_raw('ui_icon', $pod->pod_data['options']);
     if (!empty($icon)) {
         $icon = pods_image_url($icon, '32x32');
     }
     $filters = pods_var_raw('ui_filters', $pod->pod_data['options']);
     if (!empty($filters)) {
         $filters_new = array();
         foreach ($filters as $filter_field) {
             if (isset($pod->pod_data['fields'][$filter_field])) {
                 $filters_new[$filter_field] = $pod->pod_data['fields'][$filter_field];
             } elseif (isset($pod->pod_data['object_fields'][$filter_field])) {
                 $filters_new[$filter_field] = $pod->pod_data['object_fields'][$filter_field];
             }
         }
         $filters = $filters_new;
     }
     $ui = array('pod' => $pod, 'fields' => array('manage' => $manage, 'add' => $pod->pod_data['fields'], 'edit' => $pod->pod_data['fields'], 'duplicate' => $pod->pod_data['fields']), 'icon' => $icon, 'actions_disabled' => $actions_disabled);
     if (!empty($filters)) {
//.........这里部分代码省略.........
开发者ID:centaurustech,项目名称:chipin,代码行数:101,代码来源:PodsAdmin.php


注:本文中的PodsForm::field_setup方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。