Check Content Type in Paragraph Preprocess I've written a paragraph preprocess function that is working perfectly. The only issue is that I need it to only work when that paragraph is embedded in a certain content type. 

function mytheme_preprocess_paragraph__paragraph_type(&amp;$variables) {
   // Do things here if content type == 'specified_type'
}


I'm unsure of how to check the content type, though. How can I accomplish this?
The correct way of getting the entity data referencing to your paragraph is to use Paragraph's entity API. 

/**
 * Implements template_preprocess_paragraph().
 *
 * @param array $variables
 *   An associative array containing:
 *   - elements: An array of elements to display in view mode.
 *   - paragraph: The paragraph object.
 *   - view_mode: View mode; e.g., 'full', 'teaser'...
 */

function mytheme_preprocess_paragraph(&amp;$variables) {
  /** @var \Drupal\paragraphs\Entity\Paragraph $paragraph */
  $paragraph = $variables['paragraph'];
  // Get the parent bundle.
  $parentBundle = $paragraph-&gt;getParentEntity()-&gt;bundle();
}