Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
sgssandhu committed Jul 6, 2021
1 parent 433835f commit 9e5874f
Show file tree
Hide file tree
Showing 7 changed files with 262 additions and 22 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,4 +112,7 @@ REMOVED: Removed PWA functionality. Created a separate plugin for PWA
UPDATED: PHP 7.4 compatibility

## 1.8.0.0 27-05-2021
ADDED: contact_info shortcode
ADDED: contact_info shortcode

## 1.9.0.0 06-07-2021
ADDED: Structured data header and footer
54 changes: 54 additions & 0 deletions admin/class-component-edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,14 @@ public function init_admin() {
'default' => 'side',
'post_types' => 'custom',
);

$this->boxes['types_filter'] = array(
'callback' => array($this, 'filters'),
'title' => __('Filters', 'aione-app-builder'),
'default' => 'side',
'post_types' => 'custom',
);

$this->boxes['types_admin_columns_order'] = array(
'callback' => array($this, 'box_admin_columns_order'),
'title' => __('Admin Columns Order', 'aione-app-builder'),
Expand Down Expand Up @@ -899,6 +907,52 @@ public function box_admin_custom_columns(){
}
}

public function filters(){
global $aione;
$form = array();

$component_slug = sanitize_text_field( $_GET['aione-component-slug'] );
$groups = acf_get_field_groups(array('post_type' => $component_slug));

if(!empty($groups)){
foreach ($groups as $key => $group) {
$options = array();
$fields = acf_get_fields($group['key']);

if(!empty($fields)){
foreach ( $fields as $field_key => $field ) {
$options[$field['key']] = array(
'#name' => 'ct[filters][' . $field['key'] . ']',
'#title' => $field['label'],
'#default_value' => ( ! empty( $this->ct['filters'][ $field['key'] ] ) ),
'#inline' => true,
'#before' => '<li>',
'#after' => '</li>',
'#attributes' => array(
//'disabled' => 'disabled',
),
);
}
$form['filters_'.$group['ID']] = array(
'#type' => 'checkboxes',
'#options' => $options,
'#name' => 'ct[filters]',
'#inline' => true,
'#before' => '<ul class="aione-list">',
'#after' => '</ul>',

);
} // if fields
}

//echo "<pre>";print_r($form);echo "</pre>";
$form = aione_form(__FUNCTION__, $form);
echo $form->renderForm();
} else {
echo "No ACF group is applied to this component";
}
}

public function box_admin_columns_order(){
$post_type_option = new Aione_App_Builder_Admin_Components_Utils();
$custom_types = $post_type_option->get_components();
Expand Down
89 changes: 88 additions & 1 deletion admin/class-template-edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,18 @@ public function init_admin()
'default' => 'advanced',
'post_types' => 'custom',
),
'types_structured_data_header' => array(
'callback' => array($this, 'box_structured_data_header'),
'title' => __('Structured Data Header', 'aione-app-builder'),
'default' => 'advanced',
'post_types' => 'custom',
),
'types_structured_data_footer' => array(
'callback' => array($this, 'box_structured_data_footer'),
'title' => __('Structured Data Footer', 'aione-app-builder'),
'default' => 'advanced',
'post_types' => 'custom',
),
'types_applyto' => array(
'callback' => array($this, 'box_applyto'),
'title' => __('Applied to', 'aione-app-builder'),
Expand Down Expand Up @@ -377,10 +389,83 @@ public function box_structured_data()
'textarea_name' => 'at[structured_data]',
);

/*echo "
<div id='structured_data_content' style='height: 300px;'></div>
<script src='https://cdnjs.cloudflare.com/ajax/libs/ace/1.3.3/ace.js?ver=7.7.0.0' id='ace-editor-js-js'></script>
<script>
var cssEditor = ace.edit('structured_data_content');
cssEditor.setTheme('ace/theme/twilight');
cssEditor.session.setMode('ace/mode/json');
cssEditor.session.setValue(JSON.stringify(jsonDoc, null, '\t'));
cssEditor.session.setValue('');
cssEditor.setOptions({
autoScrollEditorIntoView: true,
fontSize: '14px',
});
</script>
";*/

echo wp_editor( $content, $editor_id, $settings );

}

public function box_structured_data_header()
{
$form = array();
$content = isset( $this->at['structured_data_header'] ) ? $this->at['structured_data_header']:'';
$editor_id = 'aione_template_structured_data_header';
$settings = array(
'textarea_name' => 'at[structured_data_header]',
);

echo wp_editor( $content, $editor_id, $settings );

/*echo "
<div id='structured_data_header_content' style='height: 300px;'></div>
<script src='https://cdnjs.cloudflare.com/ajax/libs/ace/1.3.3/ace.js?ver=7.7.0.0' id='ace-editor-js-js'></script>
<script>
var cssEditor = ace.edit('structured_data_header_content');
cssEditor.setTheme('ace/theme/twilight');
cssEditor.session.setMode('ace/mode/json');
cssEditor.session.setValue(JSON.stringify(jsonDoc, null, '\t'));
cssEditor.session.setValue('');
cssEditor.setOptions({
autoScrollEditorIntoView: true,
fontSize: '14px',
});
</script>
";*/

}

public function box_structured_data_footer()
{
$form = array();
$content = isset( $this->at['structured_data_footer'] ) ? $this->at['structured_data_footer']:'';
$editor_id = 'aione_template_structured_data_footer';
$settings = array(
'textarea_name' => 'at[structured_data_footer]',
);

echo wp_editor( $content, $editor_id, $settings );

/*echo "
<div id='structured_data_footer_content' style='height: 300px;'></div>
<script src='https://cdnjs.cloudflare.com/ajax/libs/ace/1.3.3/ace.js?ver=7.7.0.0' id='ace-editor-js-js'></script>
<script>
var cssEditor = ace.edit('structured_data_footer_content');
cssEditor.setTheme('ace/theme/twilight');
cssEditor.session.setMode('ace/mode/json');
cssEditor.session.setValue(JSON.stringify(jsonDoc, null, '\t'));
cssEditor.setOptions({
autoScrollEditorIntoView: true,
fontSize: '14px',
});
</script>
";*/

}

public function box_archive_header()
{
$form = array();
Expand Down Expand Up @@ -854,7 +939,7 @@ private function save()

// Check overwriting
if ( ( !array_key_exists( $this->get_id, $data ) || $data[$this->get_id] != $data['slug'] ) && array_key_exists( $data['slug'], $custom_templates ) ) {
aione_admin_message( __( 'Template with name "'.$data['name'].'" is already exists. Please choose a different name.', 'aione-app-builder' ), 'error' );
aione_admin_message( __( 'Template with name "'.$data['name'].'" already exists. Please choose a different name.', 'aione-app-builder' ), 'error' );
return false;
}

Expand All @@ -873,6 +958,8 @@ private function save()

//$data['structured_data'] = wp_kses_post($data['structured_data']);
$data['structured_data'] = html_entity_decode(stripcslashes($data['structured_data']));
$data['structured_data_header'] = html_entity_decode(stripcslashes($data['structured_data_header']));
$data['structured_data_footer'] = html_entity_decode(stripcslashes($data['structured_data_footer']));
$data['archive_header'] = html_entity_decode(stripcslashes($data['archive_header']));
$data['archive_footer'] = html_entity_decode(stripcslashes($data['archive_footer']));

Expand Down
12 changes: 12 additions & 0 deletions admin/js/aione-app-builder-admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -1351,6 +1351,18 @@
} );
});

jQuery( document ).ready( function() {
jQuery('input[type="radio"]').click(function(){
if($(this).attr("value") == 'single') {
jQuery('#types_structured_data_header').css('display', 'none');
jQuery('#types_structured_data_footer').css('display', 'none');
}
else {
jQuery('#types_structured_data_header').css('display', 'block');
jQuery('#types_structured_data_footer').css('display', 'block');
}
} );
});



Expand Down
2 changes: 1 addition & 1 deletion aione-app-builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* Plugin Name: Aione App Builder
* Plugin URI: http://oxosolutions.com/products/wordpress-plugins/aione-app-builder/
* Description: Easily create custom post types and taxonomy and connect everything together.
* Version: 1.8.0.0
* Version: 1.9.0.0
* Author: OXO Solutions®
* Author URI: https://oxosolutions.com/
* License: GPL-2.0+
Expand Down
2 changes: 2 additions & 0 deletions includes/class-aione-app-builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,8 @@ private function define_public_hooks() {
$this->loader->add_shortcode( 'import', $plugin_public, 'aione_app_builder_import_shortcode' );

$this->loader->add_shortcode( 'contact_info', $plugin_public, 'aione_app_builder_contact_info_shortcode' );

$this->loader->add_shortcode( 'filters', $plugin_public, 'aione_app_builder_filters_shortcode' );

}

Expand Down
Loading

0 comments on commit 9e5874f

Please sign in to comment.