pods-framework / pods

The Pods Framework is a Content Development Framework for WordPress - It lets you create and extend content types that can be used for any project. Add fields of various types we've built in, or add your own with custom inputs, you have total control.
https://pods.io/
GNU General Public License v2.0
1.07k stars 265 forks source link

Metabox title not being used in pods_ui if there's only one metabox #4745

Open davidatwhiletrue opened 6 years ago

davidatwhiletrue commented 6 years ago

Hello. I'm using pods_group_add() to change the 'More Fields' title in a metabox with a customized title. Those metaboxes are shown in admin pages with pods_ui().

If there's more than one metabox in the page all titles defined in pods_group_add are ok, but if there's only one metabox the title is 'Fields' instead of my customized title.

Debugging a little bit I found the problem in /ui/admin/form.php ln540:

if ( ! $more && 1 == count( $groups ) ) {
  $title = __( 'Fields', 'pods' );
}
else {
  $title = $group[ 'label' ];
}

which is trying to change 'More Fields' with 'Fields' when no other field is being shown in addition to that unique metabox. To keep the customized title the if clause could be extended with:

if ( ! $more && 1 == count( $groups ) && $group[ 'label' ] == __( 'More Fields', 'pods' ) ) {
  $title = __( 'Fields', 'pods' );
}
else {
  $title = $group[ 'label' ];
}

I'll try to send a pull request for this.

Regards,

David

quasel commented 6 years ago

@pglewis thoughts? not my area ^^ seems the PR got never looked at!

davidhernando commented 6 years ago

Could you please include this in the next version? Thanks a lot!