# depicter/1.2.0/app/src/WordPress/ShortcodesServiceProvider.php

Depicter — Popup &amp; Slider Builder, version 1.2.0. 56 lines.

- Page: https://pluginprobe.com/plugins/depicter/1.2.0/code/app/src/WordPress/ShortcodesServiceProvider.php
- Raw: https://pluginprobe.com/plugins/depicter/1.2.0/raw/app/src/WordPress/ShortcodesServiceProvider.php
- Modified: 2022-07-25T11:57:46+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/depicter/1.2.0/code/app/src/WordPress/ShortcodesServiceProvider.php#L10-L20`.

```php
<?php
namespace Depicter\WordPress;

use WPEmerge\ServiceProviders\ServiceProviderInterface;

/**
 * Register shortcodes.
 */
class ShortcodesServiceProvider implements ServiceProviderInterface {
	/**
	 * {@inheritDoc}
	 */
	public function register( $container ) {
		// Nothing to register.
	}

	/**
	 * {@inheritDoc}
	 */
	public function bootstrap( $container ) {
		add_shortcode('depicter'   , [ $this, 'process_shortcode' ]);
	}

	/**
	 * Shortcode callback
	 *
	 * @param array  $attrs
	 * @param null   $content
	 *
	 * @return string
	 * @throws \Exception
	 */
	function process_shortcode( $attrs, $content = null ) {

		extract( shortcode_atts([
			'id'    => '',
			'alias' => '',
			'slug'  => ''
		],
			$attrs,
			'depicter'
		));

		$documentId = $id;

		if ( empty( $documentId ) ) {
			if( empty( $slug ) && ! empty( $alias ) ){
				$slug = $alias;
			}
			$documentId = $slug;
		}

		return \Depicter::front()->render()->document( $documentId, [ 'echo' => false ] );
	}
}

```
