five-for-the-future/plugins/wporg-5ftf/views/inputs-pledge-org-info.php
Kelly Dwan 0f675ae6c3
Create Pledge: Make form functional (#31)
This broadly enables & styles the pledge forms across the frontend and wp-admin.

- Switches field `readonly` control to a variable called `$readonly`
- Create `PledgeMeta\get_pledge_meta()` which will fetch data from `$_POST`, a pledge post, or defaults.
- Add Number of Employees field
- Update form content to match mockup:
  - fields now have help text
  - success message uses content from mockup
  - logo field is moved to the "org info" section
- Style form in theme, add some similar styles to the admin

Fixes #7, fixes #28
2019-10-08 18:29:35 -04:00

77 lines
1.8 KiB
PHP

<?php
namespace WordPressDotOrg\FiveForTheFuture\View;
/** @var array $data */
/** @var bool $readonly */
?>
<div class="form-field">
<label for="5ftf-org-name">
<?php esc_html_e( 'Organization Name', 'wordpressorg' ); ?>
</label>
<input
type="text"
id="5ftf-org-name"
name="org-name"
value="<?php echo esc_attr( $data['org-name'] ); ?>"
required
<?php echo $readonly ? 'readonly' : ''; ?>
/>
</div>
<div class="form-field form-field__logo">
<label for="5ftf-org-logo">
<?php esc_html_e( 'Logo', 'wordpressorg' ); ?>
</label>
<br />
<?php /* @todo Display existing logo here */ ?>
<input
type="file"
id="5ftf-org-logo"
name="org-logo"
/>
</div>
<div class="form-field">
<label for="5ftf-org-url">
<?php esc_html_e( 'Website Address', 'wordpressorg' ); ?>
</label>
<input
type="url"
id="5ftf-org-url"
name="org-url"
value="<?php echo esc_attr( $data['org-url'] ); ?>"
required
<?php echo $readonly ? 'readonly' : ''; ?>
/>
</div>
<div class="form-field">
<label for="5ftf-org-description">
<?php esc_html_e( 'Organization Blurb', 'wordpressorg' ); ?>
</label>
<textarea
id="5ftf-org-description"
name="org-description"
rows="5"
required
<?php echo $readonly ? 'readonly' : ''; ?>
><?php /* phpcs:ignore -- php tags should be on the same line as textarea to prevent extra whitespace */
echo esc_html( $data['org-description'] );
/* phpcs:ignore */ ?></textarea>
</div>
<div class="form-field">
<label for="5ftf-org-number-employees">
<?php esc_html_e( 'Number of Employees Being Contributed', 'wordpressorg' ); ?>
</label>
<input
type="number"
id="5ftf-org-number-employees"
name="org-number-employees"
value="<?php echo esc_attr( $data['org-number-employees'] ); ?>"
required
<?php echo $readonly ? 'readonly' : ''; ?>
/>
</div>