This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Drupal\paragraphs\Entity\Paragraph; | |
$field_type = 'text_long'; | |
// get node types | |
$node_types = \Drupal::entityTypeManager() | |
->getStorage('node_type') | |
->loadMultiple(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Single | |
use Drupal\node\Entity\Node; | |
$node = Node::load(1537); | |
$node->set('field_include_pop_up_form',0); // 0 to uncheck, 1 to check | |
$node->save(); | |
drupal_set_message($node->get('field_include_pop_up_form')->value); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Drupal\drupalsouth\EventSubscriber; | |
namespace Drupal\drupalsouth\EventSubscriber; | |
use Drupal\alexa\AlexaEvent; | |
use Drupal\views\Views; | |
use Symfony\Component\EventDispatcher\EventSubscriberInterface; | |
use Drupal\Core\Entity\EntityTypeManager; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @file | |
* Contains lotus.module. | |
*/ | |
use Drupal\user\Entity\User; | |
/** |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @file | |
* Contains lotus.module. | |
*/ | |
use Drupal\node\Entity\Node; | |
/** |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function lotus_cron() { | |
$result = \Drupal::entityQuery("user") | |
->condition('login', strtotime('-6 months'), '<=') | |
->execute(); | |
$storage_handler = \Drupal::entityTypeManager()->getStorage("user"); | |
foreach ($result AS $user) { | |
$entity = $storage_handler->load($user); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function lotus_cron() { | |
$result = \Drupal::entityQuery("node") | |
->condition('created', strtotime('-30 days'), '<=') | |
->execute(); | |
$storage_handler = \Drupal::entityTypeManager()->getStorage("node"); | |
$entities = $storage_handler->loadMultiple($result); | |
$storage_handler->delete($entities); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Controller file for Lotus Drupal 8 module. | |
* Place this file in src/Controller folder inside the lotus module folder | |
**/ | |
namespace Drupal\lotus\Controller; | |
use Drupal\Core\Controller\ControllerBase; |