pageSupportedMediaButtons(); if ( ! $isDisplayButton ) { return; } $this->addMceButtonAssets(); echo ""; } private function addMceButtonAssets() { wp_enqueue_script( 'fluentform_editor_script', fluentformMix('js/fluentform_editor_script.js'), array('jquery') ); $forms = wpFluent()->table('fluentform_forms') ->select(array('id', 'title')) ->get(); $forms = array_map(function($item) { return array('value' => $item->id, 'text'=> $item->title); }, $forms); wp_localize_script('fluentform_editor_script', 'fluentform_editor_vars', array( 'forms' => $forms )); } private function pageSupportedMediaButtons() { $currentPage = basename( $_SERVER['PHP_SELF'] ); $isEligiblePage = in_array( $currentPage, array( 'post.php', 'page.php', 'page-new.php', 'post-new.php', 'customize.php', )); $displayButton = apply_filters( 'fluentform_display_add_form_button', $isEligiblePage ); return $displayButton; } private function getMenuIcon() { return 'data:image/svg+xml;base64,'.base64_encode('dashboard_icon'); } }