Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolve issue with hiding field names #48

Merged
merged 1 commit into from Dec 9, 2014

Conversation

mustardBees
Copy link
Contributor

Hide field names unless they're titles.

Hide field names unless they're titles.
@mustardBees
Copy link
Contributor Author

I've read the contributing document now... I can resubmit to trunk if the fix is suitable?

jtsternberg added a commit that referenced this pull request Dec 9, 2014
Resolve issue with hiding field names. Props @mustardBees.
@jtsternberg jtsternberg merged commit a6eafab into CMB2:master Dec 9, 2014
@jtsternberg
Copy link
Member

Thanks Phil, and nice catch! After we get out of beta, we'll switch to master/trunk, but for now, it's all on master.

@jtsternberg
Copy link
Member

I actually had to roll this change back as it was causing the unit tests to fail. Can you provide the scenarios which your patch is meant to fix? In other words, describe what is broken, and how your PR fixes it.

@mustardBees
Copy link
Contributor Author

See the example below, with 'show_names' => false, I would expect the field headings to be hidden.

Example metabox

/**
 * Metabox to store listing information
 */
$meta_boxes['listing_information_meta_box'] = array(
    'id' => 'listing_information_meta_box',
    'title' => 'Listing Information',
    'object_types' => array( 'listing' ), // post type
    'context' => 'side',
    'priority' => 'low',
    'show_names' => false, // Show field names on the left
    'fields' => array(
        array(
            'name' => 'Address',
            'id' => $prefix . 'address',
            'type' => 'textarea_small',
        ),
        array(
            'name' => 'Telephone',
            'id' => $prefix . 'telephone',
            'type' => 'text',
        ),
    ),
);

Result

Field headings still show up

The patch simply swaps the logic around so that field headings are hidden unless the field type is title.

@jtsternberg
Copy link
Member

Ok, makes sense. There was a bit more work involved with fixing this default behavior, but it should be good to go now.

@mustardBees
Copy link
Contributor Author

Thanks and keep up the good work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants