__('General', 'wp-ultimo'), 'desc' => __('General', 'wp-ultimo'), 'type' => 'header', ); $fields['simple_text'] = array( 'type' => 'textarea', 'title' => __('Content', 'wp-ultimo'), 'placeholder' => __('E.g. Text, HTML or shortcode.', 'wp-ultimo'), 'desc' => __('You can insert plain text, HTML or a shortcode in this block.', 'wp-ultimo'), 'tooltip' => '', 'html_attr' => array( 'rows' => 6, ) ); return $fields; } // end fields; /** * Registers scripts and styles necessary to render this. * * @since 2.0.0 * @return void */ public function register_scripts() { wp_enqueue_style('wu-admin'); } // end register_scripts; /** * The list of keywords for this element. * * Return an array of strings with keywords describing this * element. Gutenberg uses this to help customers find blocks. * * e.g.: * return array( * 'WP Ultimo', * 'Billing_Address', * 'Form', * 'Cart', * ); * * @since 2.0.0 * @return array */ public function keywords() { return array( 'WP Ultimo', 'text', 'simple text', 'shortcode', 'textarea' ); } // end keywords; /** * List of default parameters for the element. * * If you are planning to add controls using the fields, * it might be a good idea to use this method to set defaults * for the parameters you are expecting. * * These defaults will be used inside a 'wp_parse_args' call * before passing the parameters down to the block render * function and the shortcode render function. * * @since 2.0.0 * @return array */ public function defaults() { return array( 'simple_text' => __('Text, HTML or shortcode.', 'wp-ultimo'), ); } // end defaults; /** * The content to be output on the screen. * * Should return HTML markup to be used to display the block. * This method is shared between the block render method and * the shortcode implementation. * * @since 2.0.0 * * @param array $atts Parameters of the block/shortcode. * @param string|null $content The content inside the shortcode. * @return string */ public function output($atts, $content = null) { return wu_get_template_contents('dashboard-widgets/simple-text', $atts); } // end output; } // end class Simple_Text_Element;