View DataLoaderBatchService.php
<?php | |
namespace Drupal\example_pantheon_loader; | |
use Drupal\Core\Database\Connection; | |
use Drupal\batch_service_interface\AbstractBatchService; | |
use Drupal\Core\Logger\LoggerChannelFactoryInterface; | |
use Drupal\Core\StringTranslation\TranslationInterface; | |
use Drupal\file\Entity\File; | |
use Drupal\Core\File\FileSystem; |
View FA_Signing.php
<?php | |
function prepareFormAssemblyQueryString(array $parameters, $salt, $expire_timeout) { | |
$parts = []; | |
$signString = ''; | |
foreach($parameters as $key => $value) { | |
$signString .= $key . $value; | |
$parts[] = rawurlencode($key) . '=' . rawurlencode($value); | |
} | |
$expireTime = time() + $expire_timeout; | |
$signString .= 'expire' . (string)$expireTime; |
View CachingController.php
<?php | |
namespace Drupal\example\Controller; | |
use Symfony\Component\HttpFoundation\Request; | |
use Drupal\Core\Controller\ControllerBase; | |
use Drupal\Core\Cache\CacheableJsonResponse; | |
use Drupal\Core\Cache\CacheableMetadata; | |
class ExampleController extends ControllerBase { |
View JsonController.php
<?php | |
namespace Drupal\example\Controller; | |
use Drupal\Core\Controller\ControllerBase; | |
use Symfony\Component\HttpFoundation\Request; | |
use Symfony\Component\HttpFoundation\JsonResponse; | |
class ExampleController extends ControllerBase { | |
public function getJson(Request $request) { |
View custom_blocks_copyright.html.twig
<div{{ attributes }}> | |
<p><span class="copyright-text">{% trans %} | |
Copyright © {{ year }} A Great Organization | |
{% endtrans %} | |
</span> | |
<span class="copyright-rights"> | |
{% trans %}All Rights Reserved{% endtrans %} | |
</span> | |
View custom_blocks.module
<?php | |
/** | |
* Implements hook_theme(). | |
*/ | |
function custom_blocks_theme($existing, $type, $theme, $path) { | |
return [ | |
'custom_blocks_copyright' => [ | |
'variables' => [ |
View CopyrightBlock.php
<?php | |
namespace Drupal\custom_blocks\Plugin\Block; | |
use Drupal\Core\Block\BlockBase; | |
/** | |
* Provides a 'CopyrightBlock' block. | |
* | |
* @Block( |
View ExampleController.php
<?php | |
public function runTask($task_id, $site_name) { | |
$plugin = $this->pluginManagerService->createInstance($task_id); | |
$site = Site::load($site_name); | |
$status = $plugin->run($site); | |
if ($status == 'Success') { | |
$output = $plugin->getTaskOutput(); |
View RunCron.php
<?php | |
namespace Drupal\sitemanager\Plugin\TaskPlugin; | |
use Drupal\sitemanager\Plugin\TaskPluginBase; | |
/** | |
* Class RunCron. | |
* | |
* @package Drupal\sitemanager\Plugin\TaskPlugin | |
* |
NewerOlder