controls['gridId'] = array(
'tab' => 'content',
'label' => esc_html__( 'Select Grid', 'ajax-filter-posts' ),
'type' => 'select',
'options' => Embed_Helper::get_grid_choices(),
'default' => 0,
'searchable' => true,
'description' => esc_html__( 'Choose a saved GridMaster layout to display.', 'ajax-filter-posts' ),
);
if ( current_user_can( 'manage_options' ) ) {
$create_url = Embed_Helper::get_create_url();
$manage_url = Embed_Helper::get_manage_url();
$links_html = '
';
if ( $create_url ) {
$links_html .= sprintf(
'
+ %s',
esc_url( $create_url ),
esc_html__( 'Create New Grid in GridMaster', 'ajax-filter-posts' )
);
}
if ( $manage_url ) {
$links_html .= sprintf(
'
%s',
esc_url( $manage_url ),
esc_html__( 'Manage All Grids', 'ajax-filter-posts' )
);
}
$links_html .= '
';
$this->controls['gridHelperLinks'] = array(
'tab' => 'content',
'type' => 'info',
'content' => $links_html,
);
}
}
/**
* Render element markup.
*/
public function render() {
$grid_id = ! empty( $this->settings['gridId'] ) ? absint( $this->settings['gridId'] ) : 0;
echo "render_attributes( '_root' )}>"; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
echo Embed_Helper::render( $grid_id ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
echo '
';
}
}