EventType.php in Open Social 10.3.x
Same filename and directory in other branches
- 8.9 modules/custom/social_demo/src/Plugin/DemoContent/EventType.php
- 8 modules/custom/social_demo/src/Plugin/DemoContent/EventType.php
- 8.2 modules/custom/social_demo/src/Plugin/DemoContent/EventType.php
- 8.3 modules/custom/social_demo/src/Plugin/DemoContent/EventType.php
- 8.4 modules/custom/social_demo/src/Plugin/DemoContent/EventType.php
- 8.5 modules/custom/social_demo/src/Plugin/DemoContent/EventType.php
- 8.6 modules/custom/social_demo/src/Plugin/DemoContent/EventType.php
- 8.7 modules/custom/social_demo/src/Plugin/DemoContent/EventType.php
- 8.8 modules/custom/social_demo/src/Plugin/DemoContent/EventType.php
- 10.0.x modules/custom/social_demo/src/Plugin/DemoContent/EventType.php
- 10.1.x modules/custom/social_demo/src/Plugin/DemoContent/EventType.php
- 10.2.x modules/custom/social_demo/src/Plugin/DemoContent/EventType.php
Namespace
Drupal\social_demo\Plugin\DemoContentFile
modules/custom/social_demo/src/Plugin/DemoContent/EventType.phpView source
<?php
namespace Drupal\social_demo\Plugin\DemoContent;
use Drupal\social_demo\DemoTaxonomyTerm;
use Drush\Log\LogLevel;
/**
* EventType Plugin for demo content.
*
* @DemoContent(
* id = "event_type",
* label = @Translation("Event type"),
* source = "content/entity/event-type.yml",
* entity_type = "taxonomy_term"
* )
*/
class EventType extends DemoTaxonomyTerm {
/**
* {@inheritdoc}
*/
public function createContent($generate = FALSE, $max = NULL) {
// Check if event types are enabled.
if (!\Drupal::moduleHandler()
->moduleExists('social_event_type')) {
return;
}
return parent::createContent($generate, $max);
}
/**
* {@inheritdoc}
*/
public function count() {
// Check if event types are enabled.
if (!\Drupal::moduleHandler()
->moduleExists('social_event_type')) {
drush_log(dt('The social event type module is not enabled.'), LogLevel::WARNING);
return FALSE;
}
return parent::count();
}
}