Skip to content

Commit

Permalink
Updated - escape input values, added Long text field
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreiIgna committed Oct 24, 2019
1 parent 84cf83f commit e95899c
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/MetaFields.php
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ public static function notEditable(array $metaField, string $metaKey) {
public static function editableTextField(array $metaField, string $metaKey) {
echo $metaField['prefix'];
?>
<input id="<?php echo $metaKey ?>" type="<?php echo $metaField['advancedType'] ?>" name="<?php echo $metaField['inputName'] ?>" placeholder="<?php echo $metaField['placeholder'] ?>" value="<?php echo $metaField['value'] ?>" class="<?php echo $metaField['class'] ?>" />
<input id="<?php echo $metaKey ?>" type="<?php echo $metaField['advancedType'] ?>" name="<?php echo $metaField['inputName'] ?>" placeholder="<?php echo esc_attr($metaField['placeholder']) ?>" value="<?php echo esc_textarea($metaField['value']) ?>" class="<?php echo esc_attr($metaField['class']) ?>" />
<?php
echo $metaField['suffix'];
}
Expand Down Expand Up @@ -852,6 +852,19 @@ public function adminFooterAssets() {
'renderEditableFieldBulk' => [MetaFields::class, 'bulkEditableTextField']
];

$fields['textarea'] = [
'name' => __('Long text', 'layered'),
'type' => 'string',
'sanitize_callback' => 'sanitize_text_field',
'renderEditableField' => function(array $metaField, string $metaKey) {
echo $metaField['prefix'];
?>
<textarea id="<?php echo $metaKey ?>" name="<?php echo $metaField['inputName'] ?>" placeholder="<?php echo esc_attr($metaField['placeholder']) ?>" class="<?php echo esc_attr($metaField['class']) ?>"><?php echo esc_textarea($metaField['value']) ?></textarea>
<?php
echo $metaField['suffix'];
}
];

$fields['checkbox'] = [
'name' => __('Checkbox', 'layered'),
'type' => 'boolean',
Expand Down

0 comments on commit e95899c

Please sign in to comment.