register( new Ranq_Forms_Elementor_Widget() ); } /** * Our style sheet inside the Elementor editor, so the form looks right while * it is being edited. * * @return void */ public static function editor_assets() { wp_enqueue_style( 'ranq-forms', RANQ_FORMS_URL . 'assets/css/form.css', array(), RANQ_FORMS_VERSION ); } /** * The list of forms for the drop down. * * @return array */ public static function form_options() { $forms = get_posts( array( 'post_type' => Ranq_Forms_Post_Type::POST_TYPE, 'post_status' => array( 'publish', 'draft' ), 'numberposts' => 200, 'orderby' => 'title', 'order' => 'ASC', 'no_found_rows' => true, ) ); $options = array( 0 => __( 'Choose a form', '2ranq-forms' ) ); foreach ( $forms as $form ) { $options[ $form->ID ] = get_the_title( $form ); } // Next to the forms themselves stand the whole sections around them. A `w` in // front of the number says a section was chosen, not a bare form. foreach ( Ranq_Forms_Widget::all_widgets() as $widget ) { $options[ 'w' . $widget['widgetId'] ] = sprintf( /* translators: %s: form name. */ __( '%s — with contact section', '2ranq-forms' ), $widget['title'] ); } return $options; } }