Loading ctools.module +6 −8 Original line number Diff line number Diff line <?php use Drupal\Core\Entity\Plugin\Condition\EntityBundle as CoreEntityBundle; use Drupal\ctools\Plugin\Condition\EntityBundle; /** * @file * Provides utility and helper APIs for Drupal developers and site builders. */ use Drupal\Core\Url; use Drupal\Core\Entity\Plugin\Condition\EntityBundle as CoreEntityBundle; use Drupal\Core\Routing\RouteMatchInterface; use Drupal\Core\Url; use Drupal\ctools\Plugin\Condition\EntityBundle; /** * Implements hook_theme(). Loading Loading @@ -50,7 +49,7 @@ function ctools_theme($existing, $type, $theme, $path) { * @param $variables */ function template_preprocess_ctools_wizard_trail(&$variables) { /** @var $wizard \Drupal\ctools\Wizard\FormWizardInterface|\Drupal\ctools\Wizard\EntityFormWizardInterface */ /** @var \Drupal\ctools\Wizard\FormWizardInterface|\Drupal\ctools\Wizard\EntityFormWizardInterface $wizard */ $wizard = $variables['wizard']; $cached_values = $variables['cached_values']; $trail = $variables['trail']; Loading @@ -67,7 +66,7 @@ function template_preprocess_ctools_wizard_trail(&$variables) { * @param $variables */ function template_preprocess_ctools_wizard_trail_links(&$variables) { /** @var $wizard \Drupal\ctools\Wizard\FormWizardInterface|\Drupal\ctools\Wizard\EntityFormWizardInterface */ /** @var \Drupal\ctools\Wizard\FormWizardInterface|\Drupal\ctools\Wizard\EntityFormWizardInterface $wizard */ $wizard = $variables['wizard']; $cached_values = $variables['cached_values']; $trail = $variables['trail']; Loading Loading @@ -105,7 +104,6 @@ function ctools_condition_info_alter(&$definitions) { } /** * Implements hook_help(). */ Loading modules/ctools_block/src/Plugin/Block/EntityField.php +2 −2 Original line number Diff line number Diff line Loading @@ -108,7 +108,7 @@ class EntityField extends BlockBase implements ContextAwarePluginInterface, Cont $this->formatterManager = $formatter_manager; // Get the entity type and field name from the plugin id. list (, $entity_type_id, $field_name) = explode(':', $plugin_id); [, $entity_type_id, $field_name] = explode(':', $plugin_id); $this->entityTypeId = $entity_type_id; $this->fieldName = $field_name; Loading Loading @@ -190,7 +190,7 @@ class EntityField extends BlockBase implements ContextAwarePluginInterface, Cont return [ 'formatter' => [ 'label' => 'above', 'type' => isset($field_type_definition['default_formatter']) ? $field_type_definition['default_formatter'] : '', 'type' => $field_type_definition['default_formatter'] ?? '', 'settings' => [], 'third_party_settings' => [], 'weight' => 0, Loading modules/ctools_views/src/Plugin/Display/Block.php +6 −6 Original line number Diff line number Diff line Loading @@ -111,7 +111,7 @@ class Block extends CoreBlock { $form['override']['pager_offset'] = [ '#type' => 'number', '#title' => $this->t('Pager offset'), '#default_value' => isset($block_configuration['pager_offset']) ? $block_configuration['pager_offset'] : 0, '#default_value' => $block_configuration['pager_offset'] ?? 0, '#description' => $this->t('For example, set this to 3 and the first 3 items will not be displayed.'), ]; } Loading @@ -127,7 +127,7 @@ class Block extends CoreBlock { '#type' => 'radios', '#title' => $this->t('Pager'), '#options' => $pager_options, '#default_value' => isset($block_configuration['pager']) ? $block_configuration['pager'] : 'view', '#default_value' => $block_configuration['pager'] ?? 'view', ]; } Loading Loading @@ -215,7 +215,7 @@ class Block extends CoreBlock { if (!empty($allow_settings['disable_filters'])) { $items = []; foreach ((array) $this->getOption('filters') as $filter_name => $item) { $item['value'] = isset($block_configuration["filter"][$filter_name]['value']) ? $block_configuration["filter"][$filter_name]['value'] : ''; $item['value'] = $block_configuration["filter"][$filter_name]['value'] ?? ''; $items[$filter_name] = $item; } $this->setOption('filters', $items); Loading Loading @@ -360,7 +360,7 @@ class Block extends CoreBlock { $allow_settings = array_filter($this->getOption('allow')); $config = $block->getConfiguration(); list(, $display_id) = explode('-', $block->getDerivativeId(), 2); [, $display_id] = explode('-', $block->getDerivativeId(), 2); // Change pager offset settings based on block configuration. if (!empty($allow_settings['offset']) && isset($config['pager_offset'])) { Loading Loading @@ -458,8 +458,8 @@ class Block extends CoreBlock { * Return the more weight */ public static function sortFieldsByWeight($a, $b) { $a_weight = isset($a['weight']) ? $a['weight'] : 0; $b_weight = isset($b['weight']) ? $b['weight'] : 0; $a_weight = $a['weight'] ?? 0; $b_weight = $b['weight'] ?? 0; if ($a_weight == $b_weight) { return 0; } Loading src/Access/AccessInterface.php +8 −0 Original line number Diff line number Diff line Loading @@ -4,6 +4,14 @@ namespace Drupal\ctools\Access; use Drupal\Core\Session\AccountInterface; /** * Ctools Access Interface. */ interface AccessInterface { /** * Provides the access method for accounts. */ public function access(AccountInterface $account); } src/Access/TempstoreAccess.php +18 −4 Original line number Diff line number Diff line Loading @@ -10,7 +10,9 @@ use Drupal\ctools\Access\AccessInterface as CToolsAccessInterface; use Drupal\Core\TempStore\SharedTempStoreFactory; use Symfony\Component\Routing\Route; /** * Tempstore Access for ctools. */ class TempstoreAccess implements CoreAccessInterface { /** Loading @@ -20,17 +22,29 @@ class TempstoreAccess implements CoreAccessInterface { */ protected $tempstore; /** * Constructor for access to shared tempstore. */ public function __construct(SharedTempStoreFactory $tempstore) { $this->tempstore = $tempstore; } /** * Retreive the tempstore factory. */ protected function getTempstore() { return $this->tempstore; } /** * Access method to find if user has access to a particular tempstore. * * @param \Symfony\Component\Routing\Route $route * @param \Drupal\Core\Routing\RouteMatchInterface $match * @param \Drupal\Core\Session\AccountInterface $account * * @return \Drupal\Core\Access\AccessResultAllowed|\Drupal\Core\Access\AccessResultForbidden */ public function access(Route $route, RouteMatchInterface $match, AccountInterface $account) { $tempstore_id = $match->getParameter('tempstore_id') ? $match->getParameter('tempstore_id') : $route->getDefault('tempstore_id'); $id = $match->getParameter($route->getRequirement('_ctools_access')); Loading Loading
ctools.module +6 −8 Original line number Diff line number Diff line <?php use Drupal\Core\Entity\Plugin\Condition\EntityBundle as CoreEntityBundle; use Drupal\ctools\Plugin\Condition\EntityBundle; /** * @file * Provides utility and helper APIs for Drupal developers and site builders. */ use Drupal\Core\Url; use Drupal\Core\Entity\Plugin\Condition\EntityBundle as CoreEntityBundle; use Drupal\Core\Routing\RouteMatchInterface; use Drupal\Core\Url; use Drupal\ctools\Plugin\Condition\EntityBundle; /** * Implements hook_theme(). Loading Loading @@ -50,7 +49,7 @@ function ctools_theme($existing, $type, $theme, $path) { * @param $variables */ function template_preprocess_ctools_wizard_trail(&$variables) { /** @var $wizard \Drupal\ctools\Wizard\FormWizardInterface|\Drupal\ctools\Wizard\EntityFormWizardInterface */ /** @var \Drupal\ctools\Wizard\FormWizardInterface|\Drupal\ctools\Wizard\EntityFormWizardInterface $wizard */ $wizard = $variables['wizard']; $cached_values = $variables['cached_values']; $trail = $variables['trail']; Loading @@ -67,7 +66,7 @@ function template_preprocess_ctools_wizard_trail(&$variables) { * @param $variables */ function template_preprocess_ctools_wizard_trail_links(&$variables) { /** @var $wizard \Drupal\ctools\Wizard\FormWizardInterface|\Drupal\ctools\Wizard\EntityFormWizardInterface */ /** @var \Drupal\ctools\Wizard\FormWizardInterface|\Drupal\ctools\Wizard\EntityFormWizardInterface $wizard */ $wizard = $variables['wizard']; $cached_values = $variables['cached_values']; $trail = $variables['trail']; Loading Loading @@ -105,7 +104,6 @@ function ctools_condition_info_alter(&$definitions) { } /** * Implements hook_help(). */ Loading
modules/ctools_block/src/Plugin/Block/EntityField.php +2 −2 Original line number Diff line number Diff line Loading @@ -108,7 +108,7 @@ class EntityField extends BlockBase implements ContextAwarePluginInterface, Cont $this->formatterManager = $formatter_manager; // Get the entity type and field name from the plugin id. list (, $entity_type_id, $field_name) = explode(':', $plugin_id); [, $entity_type_id, $field_name] = explode(':', $plugin_id); $this->entityTypeId = $entity_type_id; $this->fieldName = $field_name; Loading Loading @@ -190,7 +190,7 @@ class EntityField extends BlockBase implements ContextAwarePluginInterface, Cont return [ 'formatter' => [ 'label' => 'above', 'type' => isset($field_type_definition['default_formatter']) ? $field_type_definition['default_formatter'] : '', 'type' => $field_type_definition['default_formatter'] ?? '', 'settings' => [], 'third_party_settings' => [], 'weight' => 0, Loading
modules/ctools_views/src/Plugin/Display/Block.php +6 −6 Original line number Diff line number Diff line Loading @@ -111,7 +111,7 @@ class Block extends CoreBlock { $form['override']['pager_offset'] = [ '#type' => 'number', '#title' => $this->t('Pager offset'), '#default_value' => isset($block_configuration['pager_offset']) ? $block_configuration['pager_offset'] : 0, '#default_value' => $block_configuration['pager_offset'] ?? 0, '#description' => $this->t('For example, set this to 3 and the first 3 items will not be displayed.'), ]; } Loading @@ -127,7 +127,7 @@ class Block extends CoreBlock { '#type' => 'radios', '#title' => $this->t('Pager'), '#options' => $pager_options, '#default_value' => isset($block_configuration['pager']) ? $block_configuration['pager'] : 'view', '#default_value' => $block_configuration['pager'] ?? 'view', ]; } Loading Loading @@ -215,7 +215,7 @@ class Block extends CoreBlock { if (!empty($allow_settings['disable_filters'])) { $items = []; foreach ((array) $this->getOption('filters') as $filter_name => $item) { $item['value'] = isset($block_configuration["filter"][$filter_name]['value']) ? $block_configuration["filter"][$filter_name]['value'] : ''; $item['value'] = $block_configuration["filter"][$filter_name]['value'] ?? ''; $items[$filter_name] = $item; } $this->setOption('filters', $items); Loading Loading @@ -360,7 +360,7 @@ class Block extends CoreBlock { $allow_settings = array_filter($this->getOption('allow')); $config = $block->getConfiguration(); list(, $display_id) = explode('-', $block->getDerivativeId(), 2); [, $display_id] = explode('-', $block->getDerivativeId(), 2); // Change pager offset settings based on block configuration. if (!empty($allow_settings['offset']) && isset($config['pager_offset'])) { Loading Loading @@ -458,8 +458,8 @@ class Block extends CoreBlock { * Return the more weight */ public static function sortFieldsByWeight($a, $b) { $a_weight = isset($a['weight']) ? $a['weight'] : 0; $b_weight = isset($b['weight']) ? $b['weight'] : 0; $a_weight = $a['weight'] ?? 0; $b_weight = $b['weight'] ?? 0; if ($a_weight == $b_weight) { return 0; } Loading
src/Access/AccessInterface.php +8 −0 Original line number Diff line number Diff line Loading @@ -4,6 +4,14 @@ namespace Drupal\ctools\Access; use Drupal\Core\Session\AccountInterface; /** * Ctools Access Interface. */ interface AccessInterface { /** * Provides the access method for accounts. */ public function access(AccountInterface $account); }
src/Access/TempstoreAccess.php +18 −4 Original line number Diff line number Diff line Loading @@ -10,7 +10,9 @@ use Drupal\ctools\Access\AccessInterface as CToolsAccessInterface; use Drupal\Core\TempStore\SharedTempStoreFactory; use Symfony\Component\Routing\Route; /** * Tempstore Access for ctools. */ class TempstoreAccess implements CoreAccessInterface { /** Loading @@ -20,17 +22,29 @@ class TempstoreAccess implements CoreAccessInterface { */ protected $tempstore; /** * Constructor for access to shared tempstore. */ public function __construct(SharedTempStoreFactory $tempstore) { $this->tempstore = $tempstore; } /** * Retreive the tempstore factory. */ protected function getTempstore() { return $this->tempstore; } /** * Access method to find if user has access to a particular tempstore. * * @param \Symfony\Component\Routing\Route $route * @param \Drupal\Core\Routing\RouteMatchInterface $match * @param \Drupal\Core\Session\AccountInterface $account * * @return \Drupal\Core\Access\AccessResultAllowed|\Drupal\Core\Access\AccessResultForbidden */ public function access(Route $route, RouteMatchInterface $match, AccountInterface $account) { $tempstore_id = $match->getParameter('tempstore_id') ? $match->getParameter('tempstore_id') : $route->getDefault('tempstore_id'); $id = $match->getParameter($route->getRequirement('_ctools_access')); Loading