__('General', 'wp-multisite-waas'), 'desc' => __('General', 'wp-multisite-waas'), 'type' => 'header', ]; $fields['simple_text'] = [ 'type' => 'textarea', 'title' => __('Content', 'wp-multisite-waas'), 'placeholder' => __('E.g. Text, HTML or shortcode.', 'wp-multisite-waas'), 'desc' => __('You can insert plain text, HTML or a shortcode in this block.', 'wp-multisite-waas'), 'tooltip' => '', 'html_attr' => [ 'rows' => 6, ], ]; return $fields; } /** * Registers scripts and styles necessary to render this. * * @since 2.0.0 * @return void */ public function register_scripts(): void { wp_enqueue_style('wu-admin'); } /** * 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 Multisite WaaS', * 'Billing_Address', * 'Form', * 'Cart', * ); * * @since 2.0.0 * @return array */ public function keywords() { return [ 'WP Ultimo', 'WP Multisite WaaS', 'text', 'simple text', 'shortcode', 'textarea', ]; } /** * 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 [ 'simple_text' => __('Text, HTML or shortcode.', 'wp-multisite-waas'), ]; } /** * 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); } }