five-for-the-future/plugins/wporg-5ftf/views/inputs-pledge-org-info.php
Kelly Dwan f9d4a0bd59
Create a Pledge: Upload a logo (#45)
* Allow image uploads

* Add the logo as "generated" meta

This will be attached after we've processed the `$_FILES` object into an upload.

* Load image into media library, attach to the submitted pledge as a featured image.

* Move where image handling happens so we can pass back errors

* Pass back error if upload fails

* Create a validation function to do basic checking of form data

* Move logo uploading to a separate function, and rely on core checks for mime & filesize checking

* Tweak function name to be more clear

* Remove bmp, tiff, and ico file types
2019-10-28 11:47:56 -04:00

67 lines
1.5 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 if ( is_admin() && has_post_thumbnail() ) : ?>
<div class="form-field__logo-display">
<?php the_post_thumbnail(); ?>
</div>
<?php endif; ?>
<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>