Skip to content

Commit

Permalink
Add help and syntax for bw_contact_field shortcode #207
Browse files Browse the repository at this point in the history
  • Loading branch information
bobbingwide committed Sep 12, 2022
1 parent 67f4924 commit 518cd5f
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion shortcodes/oik-contact-field.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ function bw_contact_field( $atts, $content, $tag ) {
$type = bw_contact_field_type_from_name( $name );
$type = bw_array_get_from( $atts, '1,type', $type );
/**
* @TODO Implement logic to set the field size, placeholder value, validate required fields, etc.
* @TODO Complete the logic to set the field size, placeholder value, default value.
*/
$args = [ '#length' => 30 ];
$value = bw_array_get( $atts, 'value', null);
Expand Down Expand Up @@ -113,4 +113,19 @@ function bw_contact_field_type_from_name( $name ) {
function bw_contact_field_full_name( $name ) {
$prefix = bw_contact_form_id();
return $prefix . '_' . $name;
}


function bw_contact_field__help( $shortcode='bw_contact_field') {
return __( "Display a contact form field", "oik" );
}

function bw_contact_field__syntax( $shortcode='bw_contact_field') {
$syntax = [ "0,label" => BW_::bw_skv( 'field', "<i>" . __( "label", "oik" ) . "</i>", __( "Label for the field", "oik" ) )
, "1,type" => BW_::bw_skv( 'text', "textarea|email|checkbox", __( "Input field type", "oik" ) )
, "2,name" => BW_::bw_skv( 'field', "<i>" . __( "text", "oik" ) . "</i>", __( "Field name", "oik" ) )
, "required" => BW_::bw_skv( 'n', 'y', __("Required field") )
, "requiredindicator" => BW_::bw_skv( null, "<i>" . __( "text", "oik" ) . "</i>", __("Text to indicate the field is required. eg *") )
];
return $syntax;
}

0 comments on commit 518cd5f

Please sign in to comment.