Created
April 10, 2012 01:15
-
-
Save ringmaster/2347750 to your computer and use it in GitHub Desktop.
All-in-one data-bound post type
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class ProposalPlugin extends Plugin | |
{ | |
public function action_plugin_activation( $plugin_file ) | |
{ | |
Post::add_new_type( 'proposal' ); | |
} | |
public function action_plugin_deactivation( $plugin_file ) | |
{ | |
Post::deactivate_post_type( 'proposal' ); | |
} | |
public function filter_post_type_display($type, $foruse) | |
{ | |
$names = array( | |
'proposal' => array( | |
'singular' => _t( 'Proposal', 'proposal' ), | |
'plural' => _t( 'Proposals', 'proposal' ), | |
) | |
); | |
return isset($names[$type][$foruse]) ? $names[$type][$foruse] : $type; | |
} | |
public function action_form_publish( $form, $post ) | |
{ | |
$proposal_details = $form->insert('content', new FormControlFieldset('proposal_details', 'Proposal Details', 'admincontrol_fieldset')); | |
$proposal_details->append(new FormControlText('for_name', $post, 'Proposal For Name', 'admincontrol_text')); | |
$proposal_details->append(new FormControlText('for_company', $post, 'Proposal For Company', 'admincontrol_text')); | |
$proposal_details->append(new FormControlText('by_name', $post, 'Proposal By Name', 'admincontrol_text')); | |
$proposal_details->append(new FormControlText('by_company', $post, 'Proposal By Company', 'admincontrol_text')); | |
$proposal_details->append(new FormControlText('contact_phone', $post, 'Contact Phone', 'admincontrol_text')); | |
$proposal_details->append(new FormControlText('contact_email', $post, 'Contact Email', 'admincontrol_text')); | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment