You are here

function ContentExport::get_export_path in Content Export YAML 8

File

src/ContentExport.php, line 478

Class

ContentExport
Created by PhpStorm. User: USER Date: 11/13/18 Time: 2:04 PM

Namespace

Drupal\content_export_yaml

Code

function get_export_path($entity) {
  if (is_object($entity)) {
    $entity_type = $entity
      ->getEntityTypeId();
    $type = $entity
      ->bundle();
    $config = \Drupal::config('content_export_yaml.contentexportsetting');
    $themes_str = $config
      ->get('path_export_content_folder');
    if ($themes_str) {
      $themes_str = DRUPAL_ROOT . $themes_str;
      if ($type) {
        $final_path = $themes_str . '/' . $entity_type . '/' . $type;
      }
      else {
        $final_path = $themes_str . '/' . $entity_type;
      }
      return $final_path;
    }
    else {
      $this->logger
        ->error('Path directory empty ');
      return FALSE;
    }
  }
}