Advertisement
Guest User

Untitled

a guest
Apr 24th, 2021
223
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.93 KB | None | 0 0
  1. <?php
  2. add_filter( 'rwmb_meta_boxes', function( $meta_boxes ) {
  3.     $meta_boxes[] = [
  4.         'title'           => 'Test Text',
  5.         'id'              => 'text-trigger',
  6.         'type'            => 'block',
  7.         'icon'            => 'awards',
  8.         'category'        => 'tsm',
  9.         'context'         => 'side',
  10.         'render_callback' => function() {
  11.             echo 'This is the block content';
  12.         },
  13.         'fields'          => [
  14.             [
  15.                 'id'                => 'triggers',
  16.                 'type'              => 'group',
  17.                 'name'              => 'Контент',
  18.                 'clone'             => true,
  19.                 'sort_clone'        => true,
  20.                 'add_button'        => '+',
  21.                 'collapsible'       => true,
  22.                 'group_title'       => 'Элемент {#}',
  23.                 'save_state'        => true,
  24.                 'fields'            => [
  25.                     [
  26.                         'id'   => 'icon',
  27.                         'type' => 'single_image',
  28.                         'name' => 'Иконка',
  29.                     ],
  30.                     [
  31.                         'id'      => 'text',
  32.                         'type'    => 'wysiwyg',
  33.                         'name'    => 'Текст',
  34.                         'options' => [
  35.                             'media_buttons'   => false,
  36.                             'teeny'           => true,
  37.                             'textarea_rows'   => 10,
  38.                             'tinymce'         => [
  39.                                 'media_buttons'    => false,
  40.                                 'drag_drop_upload' => false,
  41.                                 'content_css'      => get_template_directory_uri() . '/assets/css/tinymce.min.css',
  42.                                 'toolbar1'         => 'styleselect,bold,italic,bullist,numlist,link,unlink,fullscreen',
  43.                                 'toolbar2'         => 'alignleft,aligncenter,alignright,undo,redo',
  44.                                 'style_formats'    => [
  45.                                     [
  46.                                         'title'   => 'Имитация strong',
  47.                                         'inline'  => 'span',
  48.                                         'classes' => 'strong'
  49.                                     ],
  50.                                     [
  51.                                         'title'   => 'Имитация italic',
  52.                                         'inline'  => 'span',
  53.                                         'classes' => 'em'
  54.                                     ],
  55.                                 ],
  56.                             ],
  57.                             'quicktags' => [
  58.                                 'buttons' => 'strong,em,u,link,ul,ol,li',
  59.                             ],
  60.                         ],
  61.                     ],
  62.                 ]
  63.             ],
  64.         ],
  65.     ];
  66.  
  67.     return $meta_boxes;
  68. } );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement