Ejemplo n.º 1
0
 /**
  * Builds the portion of the form showing a listing of features.
  *
  * @param \Drupal\features\Package[] $packages
  *   The packages.
  * @param \Drupal\features\FeaturesBundleInterface $bundle
  *   The current bundle
  *
  * @return array
  *   A render array of a form element.
  */
 protected function buildListing(array $packages, FeaturesBundleInterface $bundle)
 {
     $header = array('name' => array('data' => $this->t('Feature')), 'machine_name' => array('data' => $this->t('')), 'details' => array('data' => $this->t('Description'), 'class' => array(RESPONSIVE_PRIORITY_LOW)), 'version' => array('data' => $this->t('Version'), 'class' => array(RESPONSIVE_PRIORITY_LOW)), 'status' => array('data' => $this->t('Status'), 'class' => array(RESPONSIVE_PRIORITY_LOW)), 'state' => array('data' => $this->t('State'), 'class' => array(RESPONSIVE_PRIORITY_LOW)));
     $options = array();
     $first = TRUE;
     foreach ($packages as $package) {
         if ($first && $package->getStatus() == FeaturesManagerInterface::STATUS_NO_EXPORT) {
             // Don't offer new non-profile packages that are empty.
             if ($package->getStatus() === FeaturesManagerInterface::STATUS_NO_EXPORT && !$bundle->isProfilePackage($package->getMachineName()) && empty($package->getConfig())) {
                 continue;
             }
             $first = FALSE;
             $options[] = array('name' => array('data' => $this->t('The following packages are not exported.'), 'class' => 'features-export-header-row', 'colspan' => 6));
         }
         $options[$package->getMachineName()] = $this->buildPackageDetail($package, $bundle);
     }
     $element = array('#type' => 'tableselect', '#header' => $header, '#options' => $options, '#attributes' => array('class' => array('features-listing')), '#prefix' => '<div id="edit-features-preview-wrapper">', '#suffix' => '</div>');
     return $element;
 }
Ejemplo n.º 2
0
 /**
  * {@inheritdoc}
  */
 public function getExportInfo($package, FeaturesBundleInterface $bundle = NULL)
 {
     $full_name = $package['machine_name'];
     $path = '';
     // Adjust export directory to be in profile.
     if (isset($bundle) && $bundle->isProfile()) {
         $path .= 'profiles/' . $bundle->getProfileName();
     }
     // If this is not the profile package, nest the directory.
     if (!isset($bundle) || !$bundle->isProfilePackage($package['machine_name'])) {
         $path .= empty($path) ? 'modules' : '/modules';
         $export_settings = $this->getExportSettings();
         if (!empty($export_settings['folder'])) {
             $path .= '/' . $export_settings['folder'];
         }
     }
     return array($full_name, $path);
 }
Ejemplo n.º 3
0
 /**
  * {@inheritdoc}
  */
 public function getExportInfo(Package $package, FeaturesBundleInterface $bundle = NULL)
 {
     $full_name = isset($bundle) ? $bundle->getFullName($package->getMachineName()) : $package->getMachineName();
     $path = '';
     // Adjust export directory to be in profile.
     if (isset($bundle) && $bundle->isProfile()) {
         $path .= 'profiles/' . $bundle->getProfileName();
     }
     // If this is not the profile package, nest the directory.
     if (!isset($bundle) || !$bundle->isProfilePackage($package->getMachineName())) {
         $path .= empty($path) ? 'modules' : '/modules';
         $export_settings = $this->getExportSettings();
         if (!empty($export_settings['folder'])) {
             $path .= '/' . $export_settings['folder'];
         }
     }
     // Use the same path of a package to override it.
     if ($extension = $package->getExtension()) {
         $extension_path = $extension->getPath();
         $path = dirname($extension_path);
     }
     return array($full_name, $path);
 }