PluginProbe ʕ •ᴥ•ʔ
Pods – Custom Content Types and Fields / 3.1.4.3
Pods – Custom Content Types and Fields v3.1.4.3
2.7.31.4 2.8.23.5 2.9.19.5 3.0.10.5 3.1.4.3 3.2.8.4 3.3.9.2 2.8.23.4 2.9.19.4 3.0.10.4 3.1.4.2 3.2.8.3 3.3.9.1 trunk 1.14.8 2.7.31.3 2.8.23.3 2.9.19.3 3.0.10.3 3.1.4.1 3.2.0 3.2.1 3.2.1.1 3.2.2 3.2.4 3.2.5 3.2.6 3.2.7 3.2.7.1 3.2.8 3.2.8.1 3.2.8.2 3.3.0 3.3.1 3.3.2 3.3.3 3.3.4 3.3.5 3.3.6 3.3.7 3.3.8 3.3.9
pods / ui / fields / codemirror.php
pods / ui / fields Last commit date
_comment.php 1 day ago _db.php 1 day ago _hidden.php 1 day ago _label.php 1 day ago _row.php 1 day ago attachment.php 1 day ago checkbox.php 1 day ago cleditor.php 1 day ago codemirror.php 1 day ago color.php 1 day ago currency.php 1 day ago date.php 1 day ago datetime.php 1 day ago email.php 1 day ago link.php 1 day ago number.php 1 day ago oembed.php 1 day ago password.php 1 day ago phone.php 1 day ago radio.php 1 day ago select.php 1 day ago slider.php 1 day ago slug.php 1 day ago text.php 1 day ago textarea.php 1 day ago time.php 1 day ago tinymce.php 1 day ago website.php 1 day ago
codemirror.php
52 lines
1 <?php
2 // Don't load directly.
3 if ( ! defined( 'ABSPATH' ) ) {
4 die( '-1' );
5 }
6
7 pods_form_enqueue_script( 'pods-codemirror' );
8 pods_form_enqueue_style( 'pods-codemirror' );
9 pods_form_enqueue_style( 'pods-styles' );
10 pods_form_enqueue_script( 'pods-codemirror-loadmode' );
11
12 $type = 'textarea';
13 $attributes = array();
14 $attributes['tabindex'] = 2;
15 $attributes = PodsForm::merge_attributes( $attributes, $name, $form_field_type, $options, 'pods-ui-field-codemirror' );
16 ?>
17 <div class="pods-codemirror pods-compat-container pods-form-ui-field">
18 <div class="code-toolbar"><!-- Placeholder --></div>
19 <textarea<?php PodsForm::attributes( $attributes, $name, $form_field_type, $options ); ?>><?php echo esc_textarea( $value ); ?></textarea>
20 <div class="code-footer"><!-- Placeholder --></div>
21
22 <script>
23 var $textarea_<?php echo esc_js( pods_js_name( $attributes['id'] ) ); ?>,
24 codemirror_<?php echo esc_js( pods_js_name( $attributes['id'] ) ); ?>;
25
26 jQuery( function ( $ ) {
27 $textarea_<?php echo esc_js( pods_js_name( $attributes['id'] ) ); ?> = jQuery( 'textarea#<?php echo esc_js( $attributes['id'] ); ?>' );
28
29 CodeMirror.modeURL = "<?php echo esc_js( PODS_URL ); ?>ui/js/codemirror/mode/%N/%N.js";
30 if ( 'undefined' == typeof codemirror_<?php echo esc_js( pods_js_name( $attributes['id'] ) ); ?> ) {
31
32 codemirror_<?php echo esc_js( pods_js_name( $attributes['id'] ) ); ?> = CodeMirror.fromTextArea( document.getElementById( "<?php echo esc_js( $attributes['id'] ); ?>" ), {
33 lineNumbers : true,
34 matchBrackets : true,
35 mode : "application/x-httpd-php",
36 indentUnit : 4,
37 indentWithTabs : false,
38 lineWrapping : true,
39 enterMode : "keep",
40 tabMode : "shift"
41 } );
42 codemirror_<?php echo esc_js( pods_js_name( $attributes['id'] ) ); ?>.on( 'blur', function () {
43 var value = codemirror_<?php echo esc_js( pods_js_name( $attributes['id'] ) ); ?>.getValue();
44 $textarea_<?php echo esc_js( pods_js_name( $attributes['id'] ) ); ?>.val( value );
45 } );
46
47 CodeMirror.autoLoadMode( codemirror_<?php echo esc_js( pods_js_name( $attributes['id'] ) ); ?>, 'php' );
48 }
49 } );
50 </script>
51 </div>
52