five-for-the-future/plugins/wporg-5ftf/views/inputs-pledge-contributors.php
Corey McKrill 9c08692d5d
New Pledge: Validate submitted form values and generate a draft pledge post (#35)
Ensures that a submission to the new pledge form has:

* A unique email address compared to existing pledges
* A unique domain in the URL, compared to existing pledges
* Has at least one valid contributor listed

Error messages when one or more of these conditions isn't met are descriptive so that the submitter can correct the issue.

Fixes #15
2019-10-18 16:56:21 -07:00

35 lines
742 B
PHP

<?php
namespace WordPressDotOrg\FiveForTheFuture\View;
/** @var array $contributors */
/** @var array $data */
/** @var bool $readonly */
?>
<?php if ( empty( $contributors ) ) : ?>
<div class="form-field">
<label for="5ftf-pledge-contributors">
<?php esc_html_e( 'Contributors', 'wordpressorg' ); ?>
</label>
<input
type="text"
id="5ftf-pledge-contributors"
name="pledge-contributors"
value="<?php echo esc_attr( $data['pledge-contributors'] ); ?>"
required
aria-describedby="5ftf-pledge-contributors-help"
/>
<p id="5ftf-pledge-contributors-help">
<?php esc_html_e( 'Separate each username with a comma.', 'wordpressorg' ); ?>
</p>
</div>
<?php else : ?>
<div class="5ftf-contributors">
</div>
<?php endif; ?>