Rename to subset, since context is also used elsewhere

This commit is contained in:
Kelly Dwan 2019-11-21 18:35:22 -05:00
parent c614d63056
commit 60fd0d2fb3
No known key found for this signature in database
GPG key ID: 8BA5575F3D11575D

View file

@ -28,11 +28,11 @@ add_action( 'added_post_meta', __NAMESPACE__ . '\update_generated_meta', 10, 4
/** /**
* Define pledge meta fields and their properties. * Define pledge meta fields and their properties.
* *
* @param string $context Optional. The part of the config to return. 'user_input', 'generated', or 'all'. * @param string $subset Optional. The part of the config to return: 'user_input', 'generated', or 'all'.
* *
* @return array * @return array
*/ */
function get_pledge_meta_config( $context = 'all' ) { function get_pledge_meta_config( $subset = 'all' ) {
$user_input = array( $user_input = array(
'org-description' => array( 'org-description' => array(
'single' => true, 'single' => true,
@ -83,7 +83,7 @@ function get_pledge_meta_config( $context = 'all' ) {
), ),
); );
switch ( $context ) { switch ( $subset ) {
case 'user_input': case 'user_input':
$return = $user_input; $return = $user_input;
break; break;
@ -428,15 +428,16 @@ function has_required_pledge_meta( array $submission ) {
/** /**
* Get the metadata for a given pledge, or a default set if no pledge is provided. * Get the metadata for a given pledge, or a default set if no pledge is provided.
* *
* @param int $pledge_id * @param int $pledge_id Pledge to fetch data from.
* @param string $context * @param string $subset Optional. The part of the config to return: 'user_input', 'generated', or 'all'.
*
* @return array Pledge data * @return array Pledge data
*/ */
function get_pledge_meta( $pledge_id = 0, $context = '' ) { function get_pledge_meta( $pledge_id = 0, $subset = '' ) {
// Get existing pledge, if it exists. // Get existing pledge, if it exists.
$pledge = get_post( $pledge_id ); $pledge = get_post( $pledge_id );
$keys = get_pledge_meta_config( $context ); $keys = get_pledge_meta_config( $subset );
$meta = array(); $meta = array();
// Get POST'd submission, if it exists. // Get POST'd submission, if it exists.