You are here

public function EntityFields::getDefaultFields in Simplifying 8

Get entity fields list.

2 calls to EntityFields::getDefaultFields()
EntityFields::formFields in src/Services/EntityFields.php
Get settings entity form fields.
EntityFields::getFields in src/Services/EntityFields.php
Get entity form fields.

File

src/Services/EntityFields.php, line 159

Class

EntityFields
Class EntityFields.

Namespace

Drupal\simplifying\Services

Code

public function getDefaultFields($type) {
  $fields = [];
  switch ($type) {

    // Nodes.
    case 'nodes':
      $fields['author'] = $this
        ->t('Authoring information');
      $fields['format'] = $this
        ->t('Text format selection');
      $fields['options'] = $this
        ->t('Promotion options');
      $fields['revision_information'] = $this
        ->t('Revision information');
      $fields['url_redirects'] = $this
        ->t('Url redirects');
      if ($this->modulehandler
        ->moduleExists('menu_ui')) {
        $fields['menu'] = $this
          ->t('Menu settings');
      }
      if ($this->modulehandler
        ->moduleExists('path')) {
        $fields['path'] = $this
          ->t('URL path settings');
      }
      if ($this->modulehandler
        ->moduleExists('simple_sitemap')) {
        $fields['simple_sitemap'] = $this
          ->t('XML sitemap');
      }
      if ($this->modulehandler
        ->moduleExists('drupal_seo')) {
        $fields['drupal_seo'] = $this
          ->t('Drupal seo');
      }
      $fields['field_comments'] = $this
        ->t('Comments');
      break;

    // Users.
    case 'users':
      $fields['format'] = $this
        ->t('Text format selection');
      $fields['status'] = $this
        ->t('Status (blocked/active)');
      $fields['notify'] = $this
        ->t('User notify');
      $fields['roles'] = $this
        ->t('User roles');
      if ($this->modulehandler
        ->moduleExists('path')) {
        $fields['path'] = $this
          ->t('URL path settings');
      }
      break;

    // Comments.
    case 'comments':
      $fields['format'] = $this
        ->t('Text format selection');
      break;

    // Taxonomy.
    case 'taxonomy':
      $fields['format'] = $this
        ->t('Text format selection');
      $fields['relations'] = $this
        ->t('Parents');
      if ($this->modulehandler
        ->moduleExists('path')) {
        $fields['path'] = $this
          ->t('URL path settings');
      }
      if ($this->modulehandler
        ->moduleExists('simple_sitemap')) {
        $fields['simple_sitemap'] = $this
          ->t('XML sitemap');
      }
      if ($this->modulehandler
        ->moduleExists('tvi')) {
        $fields['tvi'] = $this
          ->t('Tvi');
      }
      break;

    // Blocks.
    case 'blocks':
      $fields['format'] = $this
        ->t('Text format selection');
      $fields['revision_information'] = $this
        ->t('Revision information');
      break;
  }

  // Alter hide form fields.
  $this->modulehandler
    ->alter('simplifying_get_fields', $fields, $type);
  return $fields;
}