paper-collapsible.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. /**
  3. * WPSEO plugin file.
  4. *
  5. * @package WPSEO\Admin\Views
  6. *
  7. * @var string $paper_id The id of the paper.
  8. * @var bool $collapsible Whether the collapsible should be rendered.
  9. * @var array $collapsible_config Configuration for the collapsible.
  10. * @var string $title The title
  11. * @var string $title_after Additional content to render after the title.
  12. * @var string $view_file Path to the view file.
  13. * @var WPSEO_Admin_Help_Panel $help_text The help text.
  14. */
  15. if ( ! defined( 'WPSEO_VERSION' ) ) {
  16. header( 'Status: 403 Forbidden' );
  17. header( 'HTTP/1.1 403 Forbidden' );
  18. exit();
  19. }
  20. ?>
  21. <div class="paper tab-block" id="<?php echo esc_attr( $paper_id ); ?>">
  22. <?php
  23. if ( ! empty( $title ) ) {
  24. if ( ! empty( $collapsible ) ) {
  25. printf(
  26. '<h2 class="help-button-inline" id="%1$s"><button type="button" class="toggleable-container-trigger" aria-expanded="%4$s">%2$s <span class="toggleable-container-icon dashicons %3$s" aria-hidden="true"></span></button></h2>',
  27. esc_attr( $title ),
  28. esc_html( $title ) . $title_after . $help_text->get_button_html(),
  29. $collapsible_config['toggle_icon'],
  30. $collapsible_config['expanded']
  31. );
  32. }
  33. else {
  34. printf( '<h2 class="help-button-inline">' . esc_html( $title ) . $title_after . $help_text->get_button_html() . '</h2>' );
  35. }
  36. }
  37. ?>
  38. <?php echo $help_text->get_panel_html(); ?>
  39. <div class="<?php echo esc_attr( $collapsible_config['class'] ); ?>">
  40. <?php require $view_file; ?>
  41. </div>
  42. </div>