function( $request_value, $object ) {
if ( ! User::is_current_user_can_edit( $object->ID ) ) {
return false;
}
$document = Plugin::$instance->documents->get( $object->ID );
if ( ! $document ) {
return false;
}
$document->set_is_built_with_elementor( false );
return true;
},
]
);
}
/**
* @since 2.1.0
* @access public
*/
public function enqueue_assets() {
$document = Plugin::$instance->documents->get( get_the_ID() );
if ( ! $document || ! $document->is_editable_by_current_user() ) {
return;
}
$this->is_gutenberg_editor_active = true;
$suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
wp_enqueue_script( 'elementor-gutenberg', ELEMENTOR_ASSETS_URL . 'js/gutenberg' . $suffix . '.js', [ 'jquery' ], ELEMENTOR_VERSION, true );
$elementor_settings = [
'isElementorMode' => $document->is_built_with_elementor(),
'editLink' => $document->get_edit_url(),
];
Utils::print_js_config( 'elementor-gutenberg', 'ElementorGutenbergSettings', $elementor_settings );
}
/**
* @since 2.1.0
* @access public
*/
public function print_admin_js_template() {
if ( ! $this->is_gutenberg_editor_active ) {
return;
}
?>