Results
18.06.2020
google_tag 8.x-1.x-dev ::
src/Form/TagContainerForm.php
// Due to strict type checking, cast negation to a boolean. $configuration['negate'] = (bool) (array_key_exists('negate', $configuration) ? $configuration['negate'] : FALSE); // Update the insertion conditions on the container. $this->entity->getInsertionConditions()->addInstanceId($condition_id, $configuration); } }
18.06.2020
google_tag 8.x-1.x-dev ::
src/Plugin/Condition/ResponseCode.php
$response_codes = array_map('trim', explode("\n", $this->configuration['response_codes'])); $response_codes = implode(', ', $response_codes); if (!empty($this->configuration['negate'])) { return $this->t('Do not return true on the following response codes: @response_codes', ['@response_codes' => $response_codes]); } return $this->t('Return true on the following response codes: @response_codes', ['@response_codes' => $response_codes]); } /**
25.05.2020
http_client_error_status 8.x-1.3 ::
src/Plugin/Condition/HttpClientErrorStatus.php
$pages = implode(', ', $pages); if (!empty($this->configuration['negate'])) { return $this->t('Do not return true on the following client error pages: @pages', ['@pages' => $pages]); } return $this->t('Return true on the following client error pages: @pages', ['@pages' => $pages]); }
15.10.2020
improvements 2.x-dev ::
src/Plugin/Condition/RouteCondition.php
$routes = implode(', ', $this->getConfigurationRoutes()); if (!empty($this->configuration['negate'])) { return $this->t('Do not return true on the following routes: @routes', ['@routes' => $routes]); } return $this->t('Return true on the following routes: @routes', ['@routes' => $routes]); } /**
12.03.2020
iu_paragraphs 8.x-1.x-dev ::
src/Plugin/Condition/EntityType.php
$labels = implode(', ', $labels); if (!empty($this->configuration['negate'])) { return $this->t('Entity type is not @types or @last', [ '@types' => $labels, '@last' => $last, ]); } return $this->t('Entity type is @types or @last', [
$label = reset($labels); if (!empty($this->configuration['negate'])) { return $this->t('Entity type is not @type', ['@type' => $label]); } return $this->t('Entity type is @type', ['@type' => $label]); } /**
07.06.2020
look 8.x-1.3 ::
src/Plugin/Condition/Look.php
$looks = $this->entityStorage->loadMultiple($this->configuration['looks']); if (empty($looks)) { $applies = empty($this->configuration['negate']) ? 'all' : 'no'; return $this->t('Applies for: @applies looks', ['@applies' => $applies]); } $look_names = []; /** @var \Drupal\look\Entity\Look $look */ foreach ($looks as $look) { $look_names[] = $look->getName();
$look_names[] = $look->getName(); } $applies = empty($this->configuration['negate']) ? 'Applies' : 'Not applies'; return $this->t('@applies for: @looks', [ '@applies' => $applies, '@looks' => implode(', ', $look_names), ]); }
28.05.2020
memory_limit_policy 8.x-1.2 ::
src/MemoryLimitConstraintBase.php
*/ public function isNegated() { return !empty($this->configuration['negate']); } /** * {@inheritdoc} */ public function defaultConfiguration() {
*/ public function submitConfigurationForm(array &$form, FormStateInterface $form_state) { $this->configuration['negate'] = $form_state->getValue('negate'); } /** * {@inheritdoc} */ public function calculateDependencies() {
*/ public function evaluate() { return !empty($this->configuration['negate']); } }
10.05.2022
migrate_conditions 1.0.0-beta1 ::
src/Plugin/ConditionBase.php
$this->negated = $configuration['negate'] ?? FALSE; $this->source = $configuration['source'] ?? NULL; parent::__construct($configuration, $plugin_id, $plugin_definition); } /** * {@inheritdoc}
10.05.2022
migrate_conditions 1.0.0-beta1 ::
src/ConditionPluginManager.php
if (str_starts_with($plugin_id, 'not:')) { $plugin_id = substr($plugin_id, 4); if (isset($configuration['negate']) && $configuration['negate'] === TRUE) { $configuration['negate'] = FALSE; } else { $configuration['negate'] = TRUE; } // We call 'this' method again so that multiple 'not:' prefixes are // handled as one might expect, even if there's no good reason to // do that. We might as well handle it! return $this->createInstance($plugin_id, $configuration); }
10.05.2022
migrate_conditions 1.0.0-beta1 ::
tests/src/Unit/condition/ArrayConditionTestBase.php
$this->assertSame($expected, $condition->evaluate($source, $row)); // Negate and expect the opposite. $configuration['negate'] = empty($configuration['negate']); $negated_condition = new $class($configuration, $this->conditionId, [], $condition_manager); $this->assertSame(!$expected, $negated_condition->evaluate($source, $row)); // Use source configuration on condition. $configuration['source'] = 'some_source_property'; // Reset negation. $configuration['negate'] = empty($configuration['negate']); $condition_with_configured_source = new $class($configuration, $this->conditionId, [], $condition_manager); $this->assertSame($expected, $condition_with_configured_source->evaluate(NULL, $row)); } /** * Data provider for ::testEvaluate().
10.05.2022
migrate_conditions 1.0.0-beta1 ::
tests/src/Unit/condition/LogicalConditionTestBase.php
->method('createInstance') ->willReturnOnConsecutiveCalls(...$conditions); $configuration['negate'] = empty($configuration['negate']); $negated_condition = new $class($configuration, $this->conditionId, [], $condition_manager); $this->assertSame(!$expected, $negated_condition->evaluate($source, $row)); // Use source configuration on condition. $configuration['source'] = 'some_source_property'; // Reset negation.
$configuration['source'] = 'some_source_property'; // Reset negation. $configuration['negate'] = empty($configuration['negate']); $condition_manager = $this->createMock('\Drupal\Component\Plugin\PluginManagerInterface'); $condition_manager->expects($this->any()) ->method('createInstance') ->willReturnOnConsecutiveCalls(...$conditions); $condition_with_configured_source = new $class($configuration, $this->conditionId, [], $condition_manager); $this->assertSame($expected, $condition_with_configured_source->evaluate(NULL, $row));
10.05.2022
migrate_conditions 1.0.0-beta1 ::
tests/src/Unit/condition/ConditionTestBase.php
$this->assertSame($expected, $condition->evaluate($source, $row)); // Negate and expect the opposite. $configuration['negate'] = empty($configuration['negate']); $negated_condition = new $class($configuration, $this->conditionId, []); $this->assertSame(!$expected, $negated_condition->evaluate($source, $row)); // Use source configuration on condition. $configuration['source'] = 'some_source_property'; // Reset negation. $configuration['negate'] = empty($configuration['negate']); $condition_with_configured_source = new $class($configuration, $this->conditionId, []); $this->assertSame($expected, $condition_with_configured_source->evaluate(NULL, $row)); } /** * Data provider for ::testEvaluate().
26.06.2018
migrate_plugins 8.x-1.x-dev ::
src/Plugin/migrate/process/SkipOnFieldsMatch.php
// By default do not negate. if (!isset($this->configuration['negate'])) { $this->configuration['negate'] = FALSE; } // Parent row is useful on sub_process iteration where row input will point // to the iteration new row. if ($this->configuration['use_parent_row']) { // @var \Drupal\migrate\Row $current_row
// On negation, skip when unmatch. if ($this->configuration['negate'] && $value != $target_value) { $message = "Skip process on unmatch {$value} != {$target_value}"; throw new MigrateSkipProcessException($message); } // On normal, skip when match. if (!$this->configuration['negate'] && $value == $target_value) { $message = "Skip process on match {$value} = {$target_value}"; throw new MigrateSkipProcessException($message); } return $value; }
11.04.2022
moderation_state_condition 1.0.0 ::
src/Plugin/Condition/ModerationState.php
if (!empty($this->configuration['negate'])) { return $this->t('The moderation state is not @states', ['@states' => $moderation_states]); } else { return $this->t('The moderation state is @states', ['@states' => $moderation_states]); } }
16.02.2020
paragraphs 8.x-1.11 ::
src/Plugin/EntityReferenceSelection/ParagraphSelection.php
], '#title' => $this->t('Which Paragraph types should be allowed?'), '#default_value' => $this->configuration['negate'], ]; // Kept for compatibility with other entity reference widgets. $form['target_bundles'] = array( '#type' => 'checkboxes', '#options' => $bundle_options_simple,
$bundles = $this->entityTypeBundleInfo->getBundleInfo('paragraph'); if (!empty($this->configuration['target_bundles'])) { if (isset($this->configuration['negate']) && $this->configuration['negate'] == '1') { $bundles = array_diff_key($bundles, $this->configuration['target_bundles']); } else { $bundles = array_intersect_key($bundles, $this->configuration['target_bundles']); } }
11.09.2019
paragraphs_selection 8.x-1.0-alpha1 ::
src/Plugin/EntityReferenceSelection/ReverseParagraphSelection.php
foreach ($selection_configuration ?? [] as $selection_field) { if (isset($selection_field['id']) && $selection_field['id'] === $field) { $form['target_bundles_drag_drop'][$bundle->id()]['enabled']['#default_value'] = !isset($this->configuration['negate']) || $this->configuration['negate'] !== '1'; $form['target_bundles_drag_drop'][$bundle->id()]['weight']['#default_value'] = $selection_field['weight']; } } } return $form;
08.10.2020
php 8.x-1.1 ::
src/Plugin/Condition/Php.php
public function summary() { if (!empty($this->configuration['php'])) { return t('When the given PHP evaluates as @state.', ['@state' => !empty($this->configuration['negate']) ? 'FALSE' : 'TRUE']); } else { return t('No PHP code has been provided.'); } }
06.11.2021
response_code_condition 8.x-1.1 ::
src/Plugin/Condition/ResponseCodeCondition.php
$response_codes = array_map('trim', explode("\n", $this->configuration['response_codes'])); $response_codes = implode(', ', $response_codes); if (!empty($this->configuration['negate'])) { return $this->t('Do not return true on the following response codes: @response_codes', ['@response_codes' => $response_codes]); } return $this->t('Return true on the following response codes: @response_codes', ['@response_codes' => $response_codes]); } /**
03.07.2020
rng 3.x-dev ::
src/Plugin/Condition/RuleScheduler.php
public function submitConfigurationForm(array &$form, FormStateInterface $form_state) { parent::submitConfigurationForm($form, $form_state); $this->configuration['negate'] = FALSE; $this->updateRuleSchedulerEntity(); } /** * Create, update, or delete the associated rule scheduler entity. *
03.07.2020
rng 3.x-dev ::
src/Plugin/Condition/UserRole.php
'@roles' => count($roles) > 1 ? implode(' and ', $roles) : reset($roles), ]; if (empty($this->configuration['negate'])) { return $this->t('User is a member of @roles', $vars); } else { return $this->t('User is not a member of @roles', $vars); } }