PodsAdmin::admin_setup_edit_options PHP Méthode

admin_setup_edit_options() public méthode

Get list of Pod options
public admin_setup_edit_options ( $pod ) : array
Résultat array
    public function admin_setup_edit_options($pod)
    {
        $options = array();
        // @todo fill this in
        $options['labels'] = array('temporary' => 'This has the fields hardcoded');
        if ('post_type' == $pod['type']) {
            $options['admin-ui'] = array('description' => array('label' => __('Post Type Description', 'pods'), 'help' => __('A short descriptive summary of what the post type is.', 'pods'), 'type' => 'text', 'default' => ''), 'show_ui' => array('label' => __('Show Admin UI', 'pods'), 'help' => __('help', 'pods'), 'type' => 'boolean', 'default' => pods_var_raw('public', $pod, true), 'boolean_yes_label' => ''), 'show_in_menu' => array('label' => __('Show Admin Menu in Dashboard', 'pods'), 'help' => __('help', 'pods'), 'type' => 'boolean', 'default' => pods_var_raw('public', $pod, true), 'dependency' => true, 'boolean_yes_label' => ''), 'menu_location_custom' => array('label' => __('Parent Menu ID (optional)', 'pods'), 'help' => __('help', 'pods'), 'type' => 'text', 'depends-on' => array('show_in_menu' => true)), 'menu_name' => array('label' => __('Menu Name', 'pods'), 'help' => __('help', 'pods'), 'type' => 'text', 'default' => '', 'depends-on' => array('show_in_menu' => true)), 'menu_position' => array('label' => __('Menu Position', 'pods'), 'help' => __('help', 'pods'), 'type' => 'number', 'default' => 0, 'depends-on' => array('show_in_menu' => true)), 'menu_icon' => array('label' => __('Menu Icon', 'pods'), 'help' => __('URL or Dashicon name for the menu icon. You may specify the path to the icon using one of the <a href="http://pods.io/docs/build/special-magic-tags/#site-tags" target="_blank">site tag</a> type <a href="http://pods.io/docs/build/special-magic-tags/" target="_blank">special magic tags</a>. For example, for a file in your theme directory, use "{@template-url}/path/to/image.png". You may also use the name of a <a href="https://developer.wordpress.org/resource/dashicons/" target="_blank">Dashicon</a>. For example, to use the empty star icon, use "dashicons-star-empty".', 'pods'), 'type' => 'text', 'default' => '', 'depends-on' => array('show_in_menu' => true)), 'show_in_nav_menus' => array('label' => __('Show in Navigation Menus', 'pods'), 'help' => __('help', 'pods'), 'type' => 'boolean', 'default' => true, 'boolean_yes_label' => ''), 'show_in_admin_bar' => array('label' => __('Show in Admin Bar "New" Menu', 'pods'), 'help' => __('help', 'pods'), 'type' => 'boolean', 'default' => true, 'boolean_yes_label' => ''));
            $options['advanced'] = array('public' => array('label' => __('Public', 'pods'), 'help' => __('help', 'pods'), 'type' => 'boolean', 'default' => true, 'boolean_yes_label' => ''), 'publicly_queryable' => array('label' => __('Publicly Queryable', 'pods'), 'help' => __('help', 'pods'), 'type' => 'boolean', 'default' => pods_var_raw('public', $pod, true), 'boolean_yes_label' => ''), 'exclude_from_search' => array('label' => __('Exclude from Search', 'pods'), 'help' => __('help', 'pods'), 'type' => 'boolean', 'default' => !pods_var_raw('public', $pod, true), 'boolean_yes_label' => ''), 'capability_type' => array('label' => __('User Capability', 'pods'), 'help' => __('Uses these capabilties for access to this post type: edit_{capability}, read_{capability}, and delete_{capability}', 'pods'), 'type' => 'pick', 'default' => 'post', 'data' => array('post' => 'post', 'page' => 'page', 'custom' => __('Custom Capability', 'pods')), 'dependency' => true), 'capability_type_custom' => array('label' => __('Custom User Capability', 'pods'), 'help' => __('help', 'pods'), 'type' => 'text', 'default' => pods_var_raw('name', $pod), 'depends-on' => array('capability_type' => 'custom')), 'capability_type_extra' => array('label' => __('Additional User Capabilities', 'pods'), 'help' => __('Enables additional capabilities for this Post Type including: delete_{capability}s, delete_private_{capability}s, delete_published_{capability}s, delete_others_{capability}s, edit_private_{capability}s, and edit_published_{capability}s', 'pods'), 'type' => 'boolean', 'default' => true, 'boolean_yes_label' => ''), 'has_archive' => array('label' => __('Enable Archive Page', 'pods'), 'help' => __('If enabled, creates an archive page with list of of items in this custom post type. Functions like a category page for posts. Can be controlled with a template in your theme called "archive-{$post-type}.php".', 'pods'), 'type' => 'boolean', 'default' => false, 'dependency' => true, 'boolean_yes_label' => ''), 'has_archive_slug' => array('label' => __('Archive Page Slug Override', 'pods'), 'help' => __('If archive page is enabled, you can override the slug used by WordPress, which defaults to the name of the post type.', 'pods'), 'type' => 'text', 'default' => '', 'depends-on' => array('has_archive' => true)), 'hierarchical' => array('label' => __('Hierarchical', 'pods'), 'help' => __('Allows for parent/ child relationships between items, just like with Pages. Note: To edit relationships in the post editor, you must enable "Page Attributes" in the "Supports" section below.', 'pods'), 'type' => 'boolean', 'default' => false, 'dependency' => true, 'boolean_yes_label' => ''), 'label_parent_item_colon' => array('label' => __('<strong>Label: </strong> Parent <span class="pods-slugged" data-sluggable="label_singular">Item</span>', 'pods'), 'help' => __('help', 'pods'), 'type' => 'text', 'default' => '', 'depends-on' => array('hierarchical' => true)), 'label_parent' => array('label' => __('<strong>Label: </strong> Parent', 'pods'), 'help' => __('help', 'pods'), 'type' => 'text', 'default' => '', 'depends-on' => array('hierarchical' => true)), 'rewrite' => array('label' => __('Rewrite', 'pods'), 'help' => __('Allows you to use pretty permalinks, if set in WordPress Settings->Reading. If not enbabled, your links will be in the form of "example.com/?pod_name=post_slug" regardless of your permalink settings.', 'pods'), 'type' => 'boolean', 'default' => true, 'dependency' => true, 'boolean_yes_label' => ''), 'rewrite_custom_slug' => array('label' => __('Custom Rewrite Slug', 'pods'), 'help' => __('Changes the first segment of the URL, which by default is the name of the Pod. For example, if your Pod is called "foo", if this field is left blank, your link will be "example.com/foo/post_slug", but if you were to enter "bar" your link will be "example.com/bar/post_slug".', 'pods'), 'type' => 'text', 'default' => '', 'depends-on' => array('rewrite' => true)), 'rewrite_with_front' => array('label' => __('Rewrite with Front', 'pods'), 'help' => __('Allows permalinks to be prepended with your front base (example: if your permalink structure is /blog/, then your links will be: Unchecked->/news/, Checked->/blog/news/)', 'pods'), 'type' => 'boolean', 'default' => true, 'depends-on' => array('rewrite' => true), 'boolean_yes_label' => ''), 'rewrite_feeds' => array('label' => __('Rewrite Feeds', 'pods'), 'help' => __('help', 'pods'), 'type' => 'boolean', 'default' => false, 'depends-on' => array('rewrite' => true), 'boolean_yes_label' => ''), 'rewrite_pages' => array('label' => __('Rewrite Pages', 'pods'), 'help' => __('help', 'pods'), 'type' => 'boolean', 'default' => true, 'depends-on' => array('rewrite' => true), 'boolean_yes_label' => ''), 'query_var' => array('label' => __('Query Var', 'pods'), 'help' => __('The Query Var is used in the URL and underneath the WordPress Rewrite API to tell WordPress what page or post type you are on. For a list of reserved Query Vars, read <a href="http://codex.wordpress.org/WordPress_Query_Vars">WordPress Query Vars</a> from the WordPress Codex.', 'pods'), 'type' => 'boolean', 'default' => true, 'boolean_yes_label' => ''), 'can_export' => array('label' => __('Exportable', 'pods'), 'help' => __('help', 'pods'), 'type' => 'boolean', 'default' => true, 'boolean_yes_label' => ''), 'default_status' => array('label' => __('Default Status', 'pods'), 'help' => __('help', 'pods'), 'type' => 'pick', 'pick_object' => 'post-status', 'default' => apply_filters('pods_api_default_status_' . pods_var_raw('name', $pod, 'post_type', null, true), 'draft', $pod)));
        } elseif ('taxonomy' == $pod['type']) {
            $options['admin-ui'] = array('show_ui' => array('label' => __('Show Admin UI', 'pods'), 'help' => __('help', 'pods'), 'type' => 'boolean', 'default' => pods_var_raw('public', $pod, true), 'dependency' => true, 'boolean_yes_label' => ''), 'menu_name' => array('label' => __('Menu Name', 'pods'), 'help' => __('help', 'pods'), 'type' => 'text', 'default' => '', 'depends-on' => array('show_ui' => true)), 'menu_location' => array('label' => __('Menu Location', 'pods'), 'help' => __('help', 'pods'), 'type' => 'pick', 'default' => 'default', 'depends-on' => array('show_ui' => true), 'data' => array('default' => __('Default - Add to associated Post Type(s) menus', 'pods'), 'settings' => __('Add to Settings menu', 'pods'), 'appearances' => __('Add to Appearances menu', 'pods'), 'objects' => __('Make a top-level menu item', 'pods'), 'top' => __('Make a new top-level menu item below Settings', 'pods'), 'submenu' => __('Add a submenu item to another menu', 'pods')), 'dependency' => true), 'menu_location_custom' => array('label' => __('Custom Menu Location', 'pods'), 'help' => __('help', 'pods'), 'type' => 'text', 'depends-on' => array('menu_location' => 'submenu')), 'menu_position' => array('label' => __('Menu Position', 'pods'), 'help' => __('help', 'pods'), 'type' => 'number', 'default' => 0, 'depends-on' => array('menu_location' => array('objects', 'top'))), 'menu_icon' => array('label' => __('Menu Icon URL', 'pods'), 'help' => __('help', 'pods'), 'type' => 'text', 'default' => '', 'depends-on' => array('menu_location' => array('objects', 'top'))), 'show_in_nav_menus' => array('label' => __('Show in Navigation Menus', 'pods'), 'help' => __('help', 'pods'), 'type' => 'boolean', 'default' => pods_var_raw('public', $pod, true), 'boolean_yes_label' => ''), 'show_tagcloud' => array('label' => __('Allow in Tagcloud Widget', 'pods'), 'help' => __('help', 'pods'), 'type' => 'boolean', 'default' => pods_var_raw('show_ui', $pod, pods_var_raw('public', $pod, true)), 'boolean_yes_label' => ''));
            if (pods_version_check('wp', '3.5')) {
                $options['admin-ui']['show_admin_column'] = array('label' => __('Show Taxonomy column on Post Types', 'pods'), 'help' => __('Whether to add a column for this taxonomy on the associated post types manage screens', 'pods'), 'type' => 'boolean', 'default' => false, 'boolean_yes_label' => '');
            }
            // Integration for Single Value Taxonomy UI
            if (function_exists('tax_single_value_meta_box')) {
                $options['admin-ui']['single_value'] = array('label' => __('Single Value Taxonomy', 'pods'), 'help' => __('Use a drop-down for the input instead of the WordPress default', 'pods'), 'type' => 'boolean', 'default' => false, 'boolean_yes_label' => '');
                $options['admin-ui']['single_value_required'] = array('label' => __('Single Value Taxonomy - Required', 'pods'), 'help' => __('A term will be selected by default in the Post Editor, not optional', 'pods'), 'type' => 'boolean', 'default' => false, 'boolean_yes_label' => '');
            }
            $options['advanced'] = array('public' => array('label' => __('Public', 'pods'), 'help' => __('help', 'pods'), 'type' => 'boolean', 'default' => true, 'boolean_yes_label' => ''), 'hierarchical' => array('label' => __('Hierarchical', 'pods'), 'help' => __('help', 'pods'), 'type' => 'boolean', 'default' => false, 'dependency' => true, 'boolean_yes_label' => ''), 'label_parent_item_colon' => array('label' => __('<strong>Label: </strong> Parent <span class="pods-slugged" data-sluggable="label_singular">Item</span>', 'pods'), 'help' => __('help', 'pods'), 'type' => 'text', 'default' => '', 'depends-on' => array('hierarchical' => true)), 'label_parent' => array('label' => __('<strong>Label: </strong> Parent', 'pods'), 'help' => __('help', 'pods'), 'type' => 'text', 'default' => '', 'depends-on' => array('hierarchical' => true)), 'label_no_terms' => array('label' => __('<strong>Label: </strong> No <span class="pods-slugged" data-sluggable="label">Items</span>', 'pods'), 'help' => __('help', 'pods'), 'type' => 'text', 'default' => '', 'depends-on' => array('hierarchical' => true)), 'rewrite' => array('label' => __('Rewrite', 'pods'), 'help' => __('help', 'pods'), 'type' => 'boolean', 'default' => true, 'dependency' => true, 'boolean_yes_label' => ''), 'rewrite_custom_slug' => array('label' => __('Custom Rewrite Slug', 'pods'), 'help' => __('help', 'pods'), 'type' => 'text', 'default' => '', 'depends-on' => array('rewrite' => true)), 'rewrite_with_front' => array('label' => __('Allow Front Prepend', 'pods'), 'help' => __('Allows permalinks to be prepended with front base (example: if your permalink structure is /blog/, then your links will be: Checked->/news/, Unchecked->/blog/news/)', 'pods'), 'type' => 'boolean', 'default' => true, 'boolean_yes_label' => '', 'depends-on' => array('rewrite' => true)), 'rewrite_hierarchical' => array('label' => __('Hierarchical Permalinks', 'pods'), 'help' => __('help', 'pods'), 'type' => 'boolean', 'default' => true, 'boolean_yes_label' => '', 'depends-on' => array('rewrite' => true)), 'capability_type' => array('label' => __('User Capability', 'pods'), 'help' => __('Uses WordPress term capabilities by default', 'pods'), 'type' => 'pick', 'default' => 'default', 'data' => array('default' => 'Default', 'custom' => __('Custom Capability', 'pods')), 'dependency' => true), 'capability_type_custom' => array('label' => __('Custom User Capability', 'pods'), 'help' => __('Enables additional capabilities for this Taxonomy including: manage_{capability}_terms, edit_{capability}_terms, assign_{capability}_terms, and delete_{capability}_terms', 'pods'), 'type' => 'text', 'default' => pods_v('name', $pod), 'depends-on' => array('capability_type' => 'custom')), 'query_var' => array('label' => __('Query Var', 'pods'), 'help' => __('help', 'pods'), 'type' => 'boolean', 'default' => false, 'boolean_yes_label' => ''), 'query_var' => array('label' => __('Query Var', 'pods'), 'help' => __('help', 'pods'), 'type' => 'boolean', 'default' => false, 'dependency' => true, 'boolean_yes_label' => ''), 'query_var_string' => array('label' => __('Custom Query Var Name', 'pods'), 'help' => __('help', 'pods'), 'type' => 'text', 'default' => '', 'depends-on' => array('query_var' => true)), 'sort' => array('label' => __('Remember order saved on Post Types', 'pods'), 'help' => __('help', 'pods'), 'type' => 'boolean', 'default' => false, 'boolean_yes_label' => ''), 'update_count_callback' => array('label' => __('Function to call when updating counts', 'pods'), 'help' => __('help', 'pods'), 'type' => 'text', 'default' => ''));
        } elseif ('settings' == $pod['type']) {
            $options['admin-ui'] = array('ui_style' => array('label' => __('Admin UI Style', 'pods'), 'help' => __('help', 'pods'), 'type' => 'pick', 'default' => 'settings', 'data' => array('settings' => __('Normal Settings Form', 'pods'), 'post_type' => __('Post Type UI', 'pods'), 'custom' => __('Custom (hook into pods_admin_ui_custom or pods_admin_ui_custom_{podname} action)', 'pods')), 'dependency' => true), 'menu_location' => array('label' => __('Menu Location', 'pods'), 'help' => __('help', 'pods'), 'type' => 'pick', 'default' => 'settings', 'data' => array('settings' => __('Add to Settings menu', 'pods'), 'appearances' => __('Add to Appearances menu', 'pods'), 'top' => __('Make a new top-level menu item below Settings', 'pods'), 'submenu' => __('Add a submenu item to another menu', 'pods')), 'dependency' => true), 'menu_location_custom' => array('label' => __('Custom Menu Location', 'pods'), 'help' => __('help', 'pods'), 'type' => 'text', 'depends-on' => array('menu_location' => 'submenu')), 'menu_position' => array('label' => __('Menu Position', 'pods'), 'help' => __('help', 'pods'), 'type' => 'number', 'default' => 0, 'depends-on' => array('menu_location' => 'top')), 'menu_icon' => array('label' => __('Menu Icon URL', 'pods'), 'help' => __('help', 'pods'), 'type' => 'text', 'default' => '', 'depends-on' => array('menu_location' => 'top')));
            // @todo fill this in
            $options['advanced'] = array('temporary' => 'This type has the fields hardcoded');
        } elseif ('pod' == $pod['type']) {
            $options['admin-ui'] = array('ui_style' => array('label' => __('Admin UI Style', 'pods'), 'help' => __('help', 'pods'), 'type' => 'pick', 'default' => 'settings', 'data' => array('post_type' => __('Normal (Looks like the Post Type UI)', 'pods'), 'custom' => __('Custom (hook into pods_admin_ui_custom or pods_admin_ui_custom_{podname} action)', 'pods')), 'dependency' => true), 'show_in_menu' => array('label' => __('Show Admin Menu in Dashboard', 'pods'), 'help' => __('help', 'pods'), 'type' => 'boolean', 'default' => false, 'boolean_yes_label' => '', 'dependency' => true), 'menu_location_custom' => array('label' => __('Parent Menu ID (optional)', 'pods'), 'help' => __('help', 'pods'), 'type' => 'text', 'depends-on' => array('show_in_menu' => true)), 'menu_position' => array('label' => __('Menu Position', 'pods'), 'help' => __('help', 'pods'), 'type' => 'number', 'default' => 0, 'depends-on' => array('show_in_menu' => true)), 'menu_icon' => array('label' => __('Menu Icon URL', 'pods'), 'help' => __('This is the icon shown to the left of the menu text for this content type.', 'pods'), 'type' => 'text', 'default' => '', 'depends-on' => array('show_in_menu' => true)), 'ui_icon' => array('label' => __('Header Icon', 'pods'), 'help' => __('This is the icon shown to the left of the heading text at the top of the manage pages for this content type.', 'pods'), 'type' => 'file', 'default' => '', 'file_edit_title' => 0, 'depends-on' => array('show_in_menu' => true)), 'ui_actions_enabled' => array('label' => __('Actions Available', 'pods'), 'help' => __('help', 'pods'), 'type' => 'pick', 'default' => 1 == pods_var('ui_export', $pod) ? array('add', 'edit', 'duplicate', 'delete', 'export') : array('add', 'edit', 'duplicate', 'delete'), 'data' => array('add' => __('Add New', 'pods'), 'edit' => __('Edit', 'pods'), 'duplicate' => __('Duplicate', 'pods'), 'delete' => __('Delete', 'pods'), 'reorder' => __('Reorder', 'pods'), 'export' => __('Export', 'pods')), 'pick_format_type' => 'multi', 'dependency' => true), 'ui_reorder_field' => array('label' => __('Reorder Field', 'pods'), 'help' => __('This is the field that will be reordered on, it should be numeric.', 'pods'), 'type' => 'text', 'default' => 'menu_order', 'depends-on' => array('ui_actions_enabled' => 'reorder')), 'ui_fields_manage' => array('label' => __('Admin Table Columns', 'pods'), 'help' => __('help', 'pods'), 'type' => 'pick', 'default' => array(), 'data' => array(), 'pick_format_type' => 'multi'), 'ui_filters' => array('label' => __('Search Filters', 'pods'), 'help' => __('help', 'pods'), 'type' => 'pick', 'default' => array(), 'data' => array(), 'pick_format_type' => 'multi'));
            if (!empty($pod['fields'])) {
                if (isset($pod['fields'][pods_var_raw('pod_index', $pod, 'name')])) {
                    $options['admin-ui']['ui_fields_manage']['default'][] = pods_var_raw('pod_index', $pod, 'name');
                }
                if (isset($pod['fields']['modified'])) {
                    $options['admin-ui']['ui_fields_manage']['default'][] = 'modified';
                }
                foreach ($pod['fields'] as $field) {
                    $type = '';
                    if (isset($field_types[$field['type']])) {
                        $type = ' <small>(' . $field_types[$field['type']]['label'] . ')</small>';
                    }
                    $options['admin-ui']['ui_fields_manage']['data'][$field['name']] = $field['label'] . $type;
                    $options['admin-ui']['ui_filters']['data'][$field['name']] = $field['label'] . $type;
                }
                $options['admin-ui']['ui_fields_manage']['data']['id'] = 'ID';
            } else {
                unset($options['admin-ui']['ui_fields_manage']);
                unset($options['admin-ui']['ui_filters']);
            }
            // @todo fill this in
            $options['advanced'] = array('temporary' => 'This type has the fields hardcoded');
        }
        /**
         * Add admin fields to the Pods editor for a specific Pod
         *
         * @params array $options The Options fields
         * @params object $pod Current Pods object
         *
         * @since unkown
         */
        $options = apply_filters('pods_admin_setup_edit_options_' . $pod['type'] . '_' . $pod['name'], $options, $pod);
        /**
         * Add admin fields to the Pods editor for any Pod of a specific content type.
         */
        $options = apply_filters('pods_admin_setup_edit_options_' . $pod['type'], $options, $pod);
        /**
         * Add admin fields to the Pods editor for all Pods
         */
        $options = apply_filters('pods_admin_setup_edit_options', $options, $pod);
        return $options;
    }