Module::get_deprecated_element_chart_shortcode_content( array $atts )

Handles the deprecated element chart shortcode.

Description

Arguments are tweaked around inside it and passed on to the new shortcode to account for back-compat.

See also

Parameters

$atts

(array) (Required) Array of shortcode attributes.

  • 'id'
    (int) Element ID. This must always be present.

Return

(string) Shortcode output.

Source

File: src/modules/evaluators/module.php

	public function get_deprecated_element_chart_shortcode_content( $atts ) {
		$this->manager()->error_handler()->deprecated_shortcode( 'element_chart', '1.0.0-beta.9', "{$this->manager()->forms()->get_prefix()}form_charts" );

		$atts['mode'] = 'element_responses';

		if ( ! isset( $atts['id'] ) ) {
			return __( 'Shortcode is missing an element ID!', 'torro-forms' );
		}

		$atts['element_id'] = $atts['id'];
		unset( $atts['id'] );

		$element = $this->manager()->forms()->get_child_manager( 'containers' )->get_child_manager( 'elements' )->get( $atts['element_id'] );
		if ( ! $element ) {
			return __( 'Shortcode is using an invalid element ID!', 'torro-forms' );
		}

		$container = $element->get_container();
		if ( ! $container ) {
			return __( 'It looks like the container for this element has been removed. Please enter a different element ID into the shortcode.', 'torro-forms' );
		}

		$atts['id'] = $container->form_id;

		return $this->get_shortcode_content( $atts );
	}

Changelog

Changelog
Version Description
1.0.0 Introduced.