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

Projects
None yet
2 participants
@mustardBees
Copy link
Contributor

commented Oct 3, 2014

Hide field names unless they're titles.

Resolve issue with hiding field names
Hide field names unless they're titles.
@mustardBees

This comment has been minimized.

Copy link
Contributor Author

commented Oct 3, 2014

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

Merge pull request #48 from mustardBees/patch-1
Resolve issue with hiding field names. Props @mustardBees.

@jtsternberg jtsternberg merged commit a6eafab into CMB2:master Dec 9, 2014

1 check passed

ci/scrutinizer Scrutinizer: No new issues
Details
@jtsternberg

This comment has been minimized.

Copy link
Member

commented Dec 9, 2014

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

This comment has been minimized.

Copy link
Member

commented Dec 9, 2014

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

This comment has been minimized.

Copy link
Contributor Author

commented Dec 9, 2014

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

This comment has been minimized.

Copy link
Member

commented Dec 9, 2014

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

@mustardBees

This comment has been minimized.

Copy link
Contributor Author

commented Dec 9, 2014

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
You can’t perform that action at this time.