esc_html__( 'Current Post’s Author' ), ); foreach ( $users as $user ) { $users_choices[ $user->ID ] = $user->display_name; } $blocks[] = array( 'name' => 'canvas/author', 'title' => esc_html__( 'Author', 'powerkit' ), 'description' => '', 'category' => 'canvas', 'keywords' => array(), 'icon' => ' ', 'supports' => array( 'className' => true, 'anchor' => true, 'html' => false, 'canvasSpacings' => true, 'canvasBorder' => true, 'canvasResponsive' => true, ), 'styles' => array(), 'location' => array(), 'sections' => array( 'general' => array( 'title' => esc_html__( 'Block Settings', 'powerkit' ), 'priority' => 5, 'open' => true, ), 'buttonSettings' => array( 'title' => esc_html__( 'Button Settings', 'powerkit' ), 'priority' => 50, ), ), 'layouts' => array(), 'fields' => array_merge( array( array( 'key' => 'author', 'label' => esc_html__( 'Author', 'powerkit' ), 'section' => 'general', 'type' => 'select', 'choices' => $users_choices, 'default' => 'current', ), array( 'key' => 'bgImage', 'label' => esc_html__( 'Background Image', 'powerkit' ), 'section' => 'general', 'type' => 'image', 'default' => '', ), array( 'key' => 'showAvatar', 'label' => esc_html__( 'Display Avatar', 'powerkit' ), 'section' => 'general', 'type' => 'toggle', 'default' => true, ), array( 'key' => 'showDescription', 'label' => esc_html__( 'Display Description', 'powerkit' ), 'section' => 'general', 'type' => 'toggle', 'default' => true, ), array( 'key' => 'overrideDescription', 'label' => esc_html__( 'Override Description', 'powerkit' ), 'section' => 'general', 'type' => 'textarea', 'default' => '', 'active_callback' => array( array( 'field' => 'showDescription', 'operator' => '==', 'value' => true, ), ), ), array( 'key' => 'descriptionLength', 'label' => esc_html__( 'Description Length', 'powerkit' ), 'section' => 'general', 'type' => 'number', 'step' => 1, 'min' => 0, 'max' => 5000, 'default' => 100, 'active_callback' => array( array( 'field' => 'showDescription', 'operator' => '==', 'value' => true, ), ), ), array( 'key' => 'showSocialAccounts', 'label' => esc_html__( 'Display Social Accounts', 'powerkit' ), 'section' => 'general', 'type' => 'toggle', 'default' => true, ), array( 'key' => 'showArchiveBtn', 'label' => esc_html__( 'Display Archive Button', 'powerkit' ), 'section' => 'general', 'type' => 'toggle', 'default' => false, ), ), powerkit_get_gutenberg_button_fields( 'button', 'buttonSettings', array( array( 'field' => 'showArchiveBtn', 'operator' => '==', 'value' => true, ), ) ) ), 'template' => dirname( __FILE__ ) . '/block/render.php', // enqueue registered scripts/styles. 'editor_style' => 'powerkit-author-block-editor-style', ); return $blocks; } } new Powerkit_Author_Block();