Comments (3)
Hi @sc0ttkclark ,
In Field Guide of Pods 2.8 I got:
Pods Admin UI config abstraction – You can now extend the configurations for Pods, Groups, and Fields themselves with their own custom groups/tabs and fields. You can also modify existing ones. This is useful for plugins/add-ons extending Pods as it has now become more powerful.
https://pods.io/2021/02/11/pods-2-8-beta-1-released-and-the-field-guide-to-pods-2-8/
Does this help me on this issue? Does Pods have document about this?
Thanks ❤️
from pods.
The 2.8 functionality allows for adding new tabs and groups of fields to the configs themselves in the admin area where you edit a Pod, Group, or Field.
Tabs in that context are the way that Admin UI works, but they are essentially groups of fields on each config object.
There remains no UI to provide tabs of fields in any WP object themselves like Post Types, Taxonomies, Users, etc.
We have not established any UI for this in those forms and this GitHub issue can serve as a place to organize that effort going forward.
from pods.
Hi @sc0ttkclark,
Thanks for your reply.
I creating a add-on for this issue. The Custom Field(s) on a Group should be add Custom CSS Class for define the Tab Warp.
Example for expected:
- Create Pods for Extend Post (Default Post Type of WordPress)
- Create Group: "Custom Data"
- In Group "Custom Data" add 4 Custom Field with Custom CSS class (Advanced / Additional CSS Classes)
- Foo Text - Custom CSS class: tab-1
- Foo Text - Custom CSS class: tab-2
- Something Text - Custom CSS class: tab-3
- Something Else Text - Custom CSS class: tab-3
The "Post" admin add/edit will be create 3 Tab in "Custom Data" with the Custom Field(s) belong to Custom CSS Tab-Class.
- The CSS for beautiful Tab will be next version
- The Label-Title of Tab I will be next version.
The PHP code is:
<?php
/**
* Plugin Name: Dev Draft
* Version: 1.0.0
*/
add_action( 'admin_enqueue_scripts', '__enqueue_pods_tabs_assets' );
function __enqueue_pods_tabs_assets(): void {
wp_enqueue_style( 'pods-tabs-style',
plugin_dir_url( __FILE__ ) . 'dev.css',
null,
null );
wp_enqueue_script( 'pods-tabs-script',
plugin_dir_url( __FILE__ ) . 'dev.js',
null,
null );
}
/**-----------------------------------------------------**/
add_filter('pods_form_ui_field_row', 'custom_tabbed_interface', 10000, 6);
function custom_tabbed_interface($output, $name, $value, $options, $pod, $id) {
$custom_class = $options['class'] ?? '';
if (preg_match('/tab-(\d+)/', $custom_class, $matches)) {
$tab_index = $matches[1];
static $current_tab = 0;
if ($tab_index !== $current_tab) {
if ($current_tab !== 0) {
$output = '</div>' . $output;
}
$output = '<div class="pods-tab" id="tab-' . $tab_index . '">' . $output;
$current_tab = $tab_index;
}
}
add_action('pods_form_pre_footer', function() use ($current_tab) {
if ($current_tab !== 0) {
echo '</div>';
}
});
return $output;
}
The JS code: (dev.js)
document.addEventListener('DOMContentLoaded', function() {
const tabs = document.querySelectorAll('.pods-tab-nav li');
const tabPanels = document.querySelectorAll('.pods-tab');
tabs.forEach((tab, index) => {
tab.addEventListener('click', () => {
tabs.forEach(node => node.classList.remove('active'));
tabPanels.forEach(panel => panel.classList.remove('active'));
tab.classList.add('active');
tabPanels[index].classList.add('active');
});
});
const defaultTab = document.querySelector('.pods-tab-nav li:first-child');
if (defaultTab) {
defaultTab.click();
}
});
The CSS code: (dev.css)
.pods-tab {
display: none;
}
.pods-tab.active {
display: block;
}
.pods-tab-nav {
display: flex;
list-style-type: none;
padding: 0;
}
.pods-tab-nav li {
margin-right: 10px;
cursor: pointer;
padding: 5px 10px;
border: 1px solid #ccc;
border-radius: 3px;
background-color: #f9f9f9;
}
.pods-tab-nav li.active {
background-color: #e2e2e2;
border-color: #888;
}
The stack is I wrong the PHP Pods Hook/Filter. I think 'pods_form_ui_field_row' used is don't right.
**And by the way I got the custom CSS class don't add to <tr> of custom field. It's add to <td> of Label. I use Gutenberg Editor.**
Please view my code and help.
Thanks ❤️
from pods.
Related Issues (20)
- Compatibility with WPML: Changes to custom field data not saving in secondary language.
- Pods Rest API sometimes not delivering HOT 1
- Fatal error : Allowed memory size of 134217728 bytes exhausted
- Pods field content deleting itself after publishing it.
- Block API: Label for color HOT 2
- Pods Conditional support "Base Fields"
- Rutube embed dont work
- Cant create field type of html HOT 3
- Block API - File Upload field issues
- Cant sorting pods block HOT 4
- CPT disable "Editor" don't send post_id by "upload type custom field" HOT 3
- Third party shortcodes failing to display consistently when embedded via code syntax field HOT 1
- API not showing custom fields on v3.2.2 HOT 6
- Shortcodes won't render via pods code syntax field HOT 1
- Uncaught TypeError: Lr() is undefined
- encrypted fields
- Recent Pods Update: Edit Pods Screen Empty HOT 21
- Custom fields not updating via REST API HOT 15
- Moving posts between pods
- Wrong translation string format causes fatal error with PHP 8.1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pods.