Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: Adicao do bloco do plugin no editor de blocos do wordpress #211

Merged
merged 1 commit into from
Aug 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions lgbtq_connect/assets/js/block.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
( function( blocks, element ) {
var el = element.createElement;

blocks.registerBlockType( 'lgbtq-connect/custom-block', {
title: 'LGBTQ+ Connect',
icon: 'location',
category: 'widgets',
edit: function( props ) {
return el(
'div',
{ className: `${props.className} gradient-border`},
'(Local onde o mapa LGBTQ+ Connect será exibido)'
);
},
} );
} )( window.wp.blocks, window.wp.element );
21 changes: 21 additions & 0 deletions lgbtq_connect/assets/styles/block_style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/* block-editor.css */
.gradient-border {
background-color: transparent;
font-weight: 500;
padding: 15px;
transform-style: preserve-3d;
perspective: 2000px;
text-align: center;
&:before{
content: '';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: transparent;
border: 3.5px solid #fff;
box-sizing: border-box;
border-image: linear-gradient(to right, rgb(229, 0, 0), rgb(255, 141, 0), rgb(255, 238, 0), rgb(2, 129, 33), rgb(0, 76, 255), rgb(119, 0, 136)) 1;
}
}
34 changes: 30 additions & 4 deletions lgbtq_connect/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/*
Plugin Name: LGBTQ+ Connect
Plugin URI: https://residenciaticbrisa.github.io/T2G8-Plugin-Wordpress/
Description: Mapa LGBTQ+ com cadastro e validação admin, promovendo locais acolhedores para a comunidade
Description: Adição de mapa com cadastro e validação, promovendo locais acolhedores para a comunidade LGBTQ+.
Version: 0.34.0
Author: Igor Brandão, Gustavo Linhares, Marcos Vinicius, Max Rohrer e Will Bernardo
License: GPL v2 or later
Expand Down Expand Up @@ -99,7 +99,7 @@ function enfileirar_scripts() {
add_action('admin_enqueue_scripts', 'enfileirar_styles_admin');

// Função para adicionar o shortcode
function meu_plugin_shortcode() {
function lc_shortcode() {
// Obtém o conteúdo do arquivo HTML
$html_content = load_meu_plugin_html();
enfileirar_scripts();
Expand All @@ -110,5 +110,31 @@ function meu_plugin_shortcode() {
return $html_content;
}

// Registra o shortcode com o nome 'meu_plugin'
add_shortcode('lgbtq_connect', 'meu_plugin_shortcode');
// Registra o shortcode com o nome 'lgbtq_connect'
add_shortcode('lgbtq_connect', 'lc_shortcode');

function lc_register_block() {
// Registra o script do bloco
wp_register_script(
'lgbtq-connect-block',
plugins_url('/assets/js/block.js', __FILE__),
array('wp-blocks', 'wp-element', 'wp-editor'),
filemtime(plugin_dir_path(__FILE__) . '/assets/js/block.js')
);


wp_register_style(
'lgbtq-connect-block-editor',
plugins_url('/assets/styles/block_style.css', __FILE__),
array('wp-edit-blocks'),
filemtime(plugin_dir_path(__FILE__) . '/assets/styles/block_style.css')
);

// Registra o bloco
register_block_type('lgbtq-connect/custom-block', array(
'editor_script' => 'lgbtq-connect-block',
'editor_style' => 'lgbtq-connect-block-editor',
'render_callback' => 'lc_shortcode',
));
}
add_action('init', 'lc_register_block');
Loading