1 ) { foreach ( $colors as $name => $scheme ) { $styles[] = array( 'name' => 'pk-social-links-' . $name, 'label' => $scheme['name'], ); } } // Templates. if ( count( (array) $templates ) > 1 ) { $additional_fields[] = array( 'key' => 'template', 'label' => esc_html__( 'Template', 'powerkit' ), 'section' => 'general', 'type' => 'select', 'default' => 'inline', 'choices' => $templates, ); $additional_fields[] = array( 'key' => 'aligning', 'label' => esc_html__( 'Aligning Items', 'powerkit' ), 'section' => 'general', 'type' => 'select', 'default' => 'default', 'choices' => array( 'default' => esc_html__( 'Default', 'powerkit' ), 'left' => esc_html__( 'Left', 'powerkit' ), 'center' => esc_html__( 'Center', 'powerkit' ), 'right' => esc_html__( 'Right', 'powerkit' ), ), 'active_callback' => array( array( 'field' => 'template', 'operator' => '==', 'value' => 'inline', ), ), ); } $blocks[] = array( 'name' => 'canvas/social-links', 'title' => esc_html__( 'Social Links', 'powerkit' ), 'category' => 'canvas', 'keywords' => array(), 'icon' => '', 'supports' => array( 'className' => true, 'anchor' => true, 'html' => false, 'canvasSpacings' => true, 'canvasBorder' => true, 'canvasResponsive' => true, ), 'styles' => $styles, 'location' => array(), 'sections' => array( 'general' => array( 'title' => esc_html__( 'Block Settings', 'powerkit' ), 'priority' => 5, 'open' => true, ), ), 'layouts' => array(), 'fields' => array_merge( $additional_fields, array( array( 'key' => 'showLabels', 'label' => esc_html__( 'Display Labels', 'powerkit' ), 'section' => 'general', 'type' => 'toggle', 'default' => true, ), array( 'key' => 'showTitles', 'label' => esc_html__( 'Display Titles', 'powerkit' ), 'section' => 'general', 'type' => 'toggle', 'default' => true, ), array( 'key' => 'showCounts', 'label' => esc_html__( 'Display Counts', 'powerkit' ), 'section' => 'general', 'type' => 'toggle', 'default' => true, ), array( 'key' => 'count', 'label' => esc_html__( 'Maximum number of social links', 'powerkit' ), 'help' => esc_html__( 'Input -1 to remove the maximum limit of the social links.', 'powerkit' ), 'section' => 'general', 'type' => 'number', 'min' => -1, 'max' => 50, 'default' => -1, ), ) ), 'template' => dirname( __FILE__ ) . '/block/render.php', // enqueue registered scripts/styles. 'editor_style' => 'powerkit-social-links-block-editor-style', ); return $blocks; } } new Powerkit_Social_Links_Block();