Created
November 30, 2020 11:19
-
-
Save sashabeep/eab25b49990ed09c58e6f3087a4a0ddf to your computer and use it in GitHub Desktop.
Pagebuilder field type color
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="field type-<?= $field['type'] ?>" data-field="<?= $name ?>"> | |
<?php if (!empty($field['caption'])): ?> | |
<div class="field-name"><?= $field['caption'] ?></div> | |
<?php endif; ?> | |
<input type="text" <?php if($value){ echo('style="background-color:'.$value.'"'); } ?> name="contentblocks_<?= $name ?>" value="<?= htmlentities($value) ?>" oninput="this.setAttribute('value', this.value)" onfocus="this.setAttribute('type', 'color')" onblur="this.setAttribute('type', 'text'); this.style.backgroundColor=this.value"> | |
<?php if (!empty($field['note'])): ?> | |
<div class="field-note"><?= $field['note'] ?></div> | |
<?php endif; ?> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Place .tpl in assets/plugins/pagebuilder/tpl
Use in pagebuilder config like any text field