You are here

class RealisticDummyContentDevelGenerateGenerator in Realistic Dummy Content 3.x

Same name and namespace in other branches
  1. 8.2 api/src/includes/RealisticDummyContentDevelGenerateGenerator.php \Drupal\realistic_dummy_content_api\includes\RealisticDummyContentDevelGenerateGenerator
  2. 7.2 api/src/includes/RealisticDummyContentDevelGenerateGenerator.php \Drupal\realistic_dummy_content_api\includes\RealisticDummyContentDevelGenerateGenerator

The "devel generate" dummy content generator.

Hierarchy

Expanded class hierarchy of RealisticDummyContentDevelGenerateGenerator

1 file declares its use of RealisticDummyContentDevelGenerateGenerator
Framework.php in api/src/Framework/Framework.php

File

api/src/includes/RealisticDummyContentDevelGenerateGenerator.php, line 10

Namespace

Drupal\realistic_dummy_content_api\includes
View source
class RealisticDummyContentDevelGenerateGenerator extends RealisticDummyContentGenerator {

  /**
   * {@inheritdoc}
   */
  public function implementGenerate() {
    $info['entity_type'] = $this
      ->getType();
    $info['kill'] = $this
      ->getKill();
    $info['num'] = $this
      ->getNum();
    if (Framework::instance()
      ->moduleExists('comment')) {
      $info['max_comments'] = 5;
    }
    if ($this
      ->getType() == 'node') {

      // See https://www.drupal.org/node/2324027
      $info = array_merge($info, [
        'node_types' => [
          $this
            ->getBundle() => $this
            ->getBundle(),
        ],
        'users' => [
          1,
        ],
        'title_length' => 3,
      ]);
    }
    Framework::instance()
      ->develGenerate($info);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
RealisticDummyContentDevelGenerateGenerator::implementGenerate public function Generate content. Used internally in the class. Overrides RealisticDummyContentGenerator::implementGenerate
RealisticDummyContentGenerator::$bundle private property The bundle of the entity to generate.
RealisticDummyContentGenerator::$kill private property Whether or not to kill previous content.
RealisticDummyContentGenerator::$more private property Placeholder for more information about this entity generation.
RealisticDummyContentGenerator::$num private property The amount of entities to generate.
RealisticDummyContentGenerator::$type private property The type of entity to generate.
RealisticDummyContentGenerator::generate public function Generate content.
RealisticDummyContentGenerator::getBundle public function Getter for the bundle property.
RealisticDummyContentGenerator::getKill public function Getter for the kill property.
RealisticDummyContentGenerator::getNum public function Getter for the num propert.
RealisticDummyContentGenerator::getType public function Getter for the type property.
RealisticDummyContentGenerator::__construct public function Constructor.