@@ -56,23 +56,23 @@ |
||
| 56 | 56 | $min = $debug ? '' : '.min'; |
| 57 | 57 | |
| 58 | 58 | // if colorpicker |
| 59 | - if ( ! is_admin() && isset( $dependencies['wp-color-picker'] ) ) { |
|
| 59 | + if ( ! is_admin() && isset( $dependencies[ 'wp-color-picker' ] ) ) { |
|
| 60 | 60 | self::colorpicker_frontend(); |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | // if file/file_list |
| 64 | - if ( isset( $dependencies['media-editor'] ) ) { |
|
| 64 | + if ( isset( $dependencies[ 'media-editor' ] ) ) { |
|
| 65 | 65 | wp_enqueue_media(); |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | // if timepicker |
| 69 | - if ( isset( $dependencies['jquery-ui-datetimepicker'] ) ) { |
|
| 69 | + if ( isset( $dependencies[ 'jquery-ui-datetimepicker' ] ) ) { |
|
| 70 | 70 | wp_register_script( 'jquery-ui-datetimepicker', cmb2_utils()->url( 'js/jquery-ui-timepicker-addon.min.js' ), array( 'jquery-ui-slider' ), CMB2_VERSION ); |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | // if cmb2-wysiwyg |
| 74 | - $enqueue_wysiwyg = isset( $dependencies['cmb2-wysiwyg'] ) && $debug; |
|
| 75 | - unset( $dependencies['cmb2-wysiwyg'] ); |
|
| 74 | + $enqueue_wysiwyg = isset( $dependencies[ 'cmb2-wysiwyg' ] ) && $debug; |
|
| 75 | + unset( $dependencies[ 'cmb2-wysiwyg' ] ); |
|
| 76 | 76 | |
| 77 | 77 | // Enqueue cmb JS |
| 78 | 78 | wp_enqueue_script( self::$handle, cmb2_utils()->url( "js/cmb2{$min}.js" ), $dependencies, CMB2_VERSION, true ); |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | ) ); |
| 29 | 29 | |
| 30 | 30 | if ( ! $field->group ) { |
| 31 | - return $this->rendered( $this->get_wp_editor( $a ) . $a['desc'] ); |
|
| 31 | + return $this->rendered( $this->get_wp_editor( $a ) . $a[ 'desc' ] ); |
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | // wysiwyg fields in a group need some special handling. |
@@ -52,27 +52,27 @@ discard block |
||
| 52 | 52 | |
| 53 | 53 | protected function get_wp_editor( $args ) { |
| 54 | 54 | ob_start(); |
| 55 | - wp_editor( $args['value'], $args['id'], $args['options'] ); |
|
| 55 | + wp_editor( $args[ 'value' ], $args[ 'id' ], $args[ 'options' ] ); |
|
| 56 | 56 | return ob_get_clean(); |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | public function add_wysiwyg_template_for_group() { |
| 60 | 60 | $group_id = $this->field->group->id(); |
| 61 | 61 | $options = $this->field->options(); |
| 62 | - $options['textarea_name'] = 'cmb2_replace_name_'. $group_id; |
|
| 62 | + $options[ 'textarea_name' ] = 'cmb2_replace_name_' . $group_id; |
|
| 63 | 63 | |
| 64 | 64 | // Initate the editor with special id/value/name so we can retrieve the options in JS. |
| 65 | 65 | $editor = $this->get_wp_editor( array( |
| 66 | - 'value' => 'cmb2_replace_value_'. $group_id, |
|
| 67 | - 'id' => 'cmb2_replace_id_'. $group_id, |
|
| 66 | + 'value' => 'cmb2_replace_value_' . $group_id, |
|
| 67 | + 'id' => 'cmb2_replace_id_' . $group_id, |
|
| 68 | 68 | 'options' => $options, |
| 69 | 69 | ) ); |
| 70 | 70 | |
| 71 | 71 | // Then replace the special id/value/name with underscore placeholders. |
| 72 | 72 | $editor = str_replace( array( |
| 73 | - 'cmb2_replace_name_'. $group_id, |
|
| 74 | - 'cmb2_replace_value_'. $group_id, |
|
| 75 | - 'cmb2_replace_id_'. $group_id, |
|
| 73 | + 'cmb2_replace_name_' . $group_id, |
|
| 74 | + 'cmb2_replace_value_' . $group_id, |
|
| 75 | + 'cmb2_replace_id_' . $group_id, |
|
| 76 | 76 | ), array( |
| 77 | 77 | '{{ data.name }}', |
| 78 | 78 | '{{{ data.value }}}', |
@@ -80,9 +80,9 @@ discard block |
||
| 80 | 80 | ), $editor ); |
| 81 | 81 | |
| 82 | 82 | // And put the editor instance in a JS template wrapper. |
| 83 | - echo '<script type="text/template" id="tmpl-cmb2-wysiwyg-'. $group_id .'">'; |
|
| 83 | + echo '<script type="text/template" id="tmpl-cmb2-wysiwyg-' . $group_id . '">'; |
|
| 84 | 84 | // Need to wrap the template in a wrapper div w/ specific data attributes which will be used when adding/removing rows. |
| 85 | - echo '<div class="cmb2-wysiwyg-inner-wrap" data-iterator="{{ data.iterator }}" data-groupid="'. $group_id .'" data-id="'. $this->field->id( true ) .'">'. $editor .'</div>'; |
|
| 85 | + echo '<div class="cmb2-wysiwyg-inner-wrap" data-iterator="{{ data.iterator }}" data-groupid="' . $group_id . '" data-id="' . $this->field->id( true ) . '">' . $editor . '</div>'; |
|
| 86 | 86 | echo '</script>'; |
| 87 | 87 | } |
| 88 | 88 | |