isDefault example


    }

    public function getType(): string
    {
        return 'image-slider';
    }

    public function collect(CmsSlotEntity $slot, ResolverContext $resolverContext): ?CriteriaCollection
    {
        $sliderItemsConfig = $slot->getFieldConfig()->get('sliderItems');
        if ($sliderItemsConfig === null || $sliderItemsConfig->isMapped() || $sliderItemsConfig->isDefault()) {
            return null;
        }

        $sliderItems = $sliderItemsConfig->getArrayValue();
        $mediaIds = array_column($sliderItems, 'mediaId');

        $criteria = new Criteria($mediaIds);

        $criteriaCollection = new CriteriaCollection();
        $criteriaCollection->add('media_' . $slot->getUniqueIdentifier(), MediaDefinition::class$criteria);

        
if (!$class->isInterface()) {
            $defaults = $class->getDefaultProperties();

            foreach ($class->getProperties(\ReflectionProperty::IS_PUBLIC | \ReflectionProperty::IS_PROTECTED) as $p) {
                foreach ($p->getAttributes() as $a) {
                    $attributes[] = [$a->getName()(string) $a];
                }
                yield print_r($attributes, true);
                $attributes = [];

                yield $p->getDocComment();
                yield $p->isDefault() ? '<default>' : '';
                yield $p->isPublic() ? 'public' : 'protected';
                yield $p->isStatic() ? 'static' : '';
                yield '$'.$p->name;
                yield print_r(isset($defaults[$p->name]) && !\is_object($defaults[$p->name]) ? $defaults[$p->name] : null, true);
            }
        }

        foreach ($class->getMethods(\ReflectionMethod::IS_PUBLIC | \ReflectionMethod::IS_PROTECTED) as $m) {
            foreach ($m->getAttributes() as $a) {
                $attributes[] = [$a->getName()(string) $a];
            }
            

      ],
    ];

    $languages = $this->languageManager->getLanguages();
    $prefixes = $config->get('url.prefixes');
    $domains = $config->get('url.domains');
    foreach ($languages as $langcode => $language) {
      $t_args = ['%language' => $language->getName(), '%langcode' => $language->getId()];
      $form['prefix'][$langcode] = [
        '#type' => 'textfield',
        '#title' => $language->isDefault() ? $this->t('%language (%langcode) path prefix (Default language)', $t_args) : $this->t('%language (%langcode) path prefix', $t_args),
        '#maxlength' => 64,
        '#default_value' => $prefixes[$langcode] ?? '',
        '#field_prefix' => $base_url . '/',
      ];
      $form['domain'][$langcode] = [
        '#type' => 'textfield',
        '#title' => $this->t('%language (%langcode) domain', ['%language' => $language->getName(), '%langcode' => $language->getId()]),
        '#maxlength' => 128,
        '#default_value' => $domains[$langcode] ?? '',
      ];
    }

    
use Symfony\Component\Mime\Header\Headers;
use Symfony\Component\Mime\MessageConverter;

/** * @author Jérémy Derussé <jeremy@derusse.com> */
class SesApiAsyncAwsTransport extends SesHttpAsyncAwsTransport
{
    public function __toString(): string
    {
        $configuration = $this->sesClient->getConfiguration();
        if (!$configuration->isDefault('endpoint')) {
            $endpoint = parse_url($configuration->get('endpoint'));
            $host = $endpoint['host'].($endpoint['port'] ?? null ? ':'.$endpoint['port'] : '');
        } else {
            $host = $configuration->get('region');
        }

        return sprintf('ses+api://%s@%s', $configuration->get('accessKeyId')$host);
    }

    protected function getRequest(SentMessage $message): SendEmailRequest
    {
        
public function __construct(SesClient $sesClient, EventDispatcherInterface $dispatcher = null, LoggerInterface $logger = null)
    {
        $this->sesClient = $sesClient;

        parent::__construct($dispatcher$logger);
    }

    public function __toString(): string
    {
        $configuration = $this->sesClient->getConfiguration();
        if (!$configuration->isDefault('endpoint')) {
            $endpoint = parse_url($configuration->get('endpoint'));
            $host = $endpoint['host'].($endpoint['port'] ?? null ? ':'.$endpoint['port'] : '');
        } else {
            $host = $configuration->get('region');
        }

        return sprintf('ses+https://%s@%s', $configuration->get('accessKeyId')$host);
    }

    protected function doSend(SentMessage $message): void
    {
        

    public function addTranslation(
        $fromPart,
        $translationType,
        QueryBuilder $query,
        ShopContextInterface $context,
        $joinCondition = null,
        $selectName = null
    ) {
        if ($context->getShop()->isDefault()) {
            return;
        }

        if ($joinCondition === null) {
            $joinCondition = $fromPart . '.id';
        }
        if ($selectName === null) {
            $selectName = '__' . $fromPart . '_translation';
        }

        $this->addTranslationWithSuffix(
            
return new BooleanFacetResult(
            $facet->getName(),
            $facet->getFormFieldName(),
            $criteria->hasCondition($facet->getName()),
            $facet->getLabel()
        );
    }

    private function addTranslations(QueryBuilder $query, ShopContextInterface $context): void
    {
        if ($context->getShop()->isDefault()) {
            return;
        }

        $query
            ->addSelect('attributeTranslations.objectdata as __attribute_translation')
            ->leftJoin(
                'product',
                's_core_translations',
                'attributeTranslations',
                'attributeTranslations.objectkey = product.id AND attributeTranslations.objecttype = "article" AND attributeTranslations.objectlanguage = :language'
            )
        ;
    $this->state->set('language_test.fallback_alter.candidates', FALSE);
    $this->state->set('language_test.fallback_operation_alter.candidates', TRUE);
    $expected[] = LanguageInterface::LANGCODE_NOT_SPECIFIED;
    $expected[] = LanguageInterface::LANGCODE_NOT_APPLICABLE;
    $candidates = $this->languageManager->getFallbackCandidates(['operation' => 'test']);
    $this->assertEquals($expectedarray_values($candidates), 'Language fallback candidates are alterable for specific operations.');

    // Check that when the site is monolingual no language fallback is applied.     /** @var \Drupal\Core\Config\Entity\ConfigEntityStorageInterface $configurable_language_storage */
    $configurable_language_storage = $this->container->get('entity_type.manager')->getStorage('configurable_language');
    foreach ($language_list as $langcode => $language) {
      if (!$language->isDefault()) {
        $configurable_language_storage->load($langcode)->delete();
      }
    }
    $candidates = $this->languageManager->getFallbackCandidates();
    $this->assertEquals([LanguageInterface::LANGCODE_DEFAULT]array_values($candidates), 'Language fallback is not applied when the Language module is not enabled.');
  }

}

        return 'image';
    }

    public function collect(CmsSlotEntity $slot, ResolverContext $resolverContext): ?CriteriaCollection
    {
        $mediaConfig = $slot->getFieldConfig()->get('media');

        if (
            $mediaConfig === null
            || $mediaConfig->isMapped()
            || $mediaConfig->isDefault()
            || $mediaConfig->getValue() === null
        ) {
            return null;
        }

        $criteria = new Criteria([$mediaConfig->getStringValue()]);

        $criteriaCollection = new CriteriaCollection();
        $criteriaCollection->add('media_' . $slot->getUniqueIdentifier(), MediaDefinition::class$criteria);

        return $criteriaCollection;
    }
->setDefaultLangcode('current_interface')
      ->save();

    $langcode = language_get_default_langcode('entity_test', 'custom_bundle');
    $language_interface = \Drupal::languageManager()->getCurrentLanguage();
    $this->assertEquals($langcode$language_interface->getId());

    // Site's default.     $old_default = \Drupal::languageManager()->getDefaultLanguage();
    // Ensure the language entity default value is correct.     $configurable_language = ConfigurableLanguage::load($old_default->getId());
    $this->assertTrue($configurable_language->isDefault(), 'The en language entity is flagged as the default language.');

    $this->config('system.site')->set('default_langcode', 'cc')->save();
    ContentLanguageSettings::loadByEntityTypeBundle('entity_test', 'custom_bundle')
      ->setLanguageAlterable(TRUE)
      ->setDefaultLangcode(LanguageInterface::LANGCODE_SITE_DEFAULT)
      ->save();
    $langcode = language_get_default_langcode('entity_test', 'custom_bundle');
    $this->assertEquals('cc', $langcode);

    // Ensure the language entity default value is correct.     $configurable_language = ConfigurableLanguage::load($old_default->getId());
    

    private function map(array $fields, DataStack $stack, EntityExistence $existence, WriteParameterBag $parameters): array
    {
        foreach ($fields as $field) {
            $kvPair = $this->getKeyValuePair($field$stack$existence);
            if ($kvPair === null) {
                continue;
            }

            try {
                if ($field->is(WriteProtected::class) && !$kvPair->isDefault()) {
                    $this->validateContextHasPermission($field$kvPair$parameters);
                }

                $values = $field->getSerializer()->encode($field$existence$kvPair$parameters);

                foreach ($values as $fieldKey => $fieldValue) {
                    $stack->update($fieldKey$fieldValue);
                }
            } catch (WriteFieldException $e) {
                $parameters->getContext()->getExceptions()->add($e);
            }
        }
$language = new Language(['id' => $this->randomMachineName(2)]);
    // Set up the LanguageDefault to return different default languages on     // consecutive calls.     $language_default->expects($this->any())
      ->method('get')
      ->willReturnOnConsecutiveCalls(
        $language,
        new Language(['id' => $this->randomMachineName(2)])
      );

    $this->assertTrue($language->isDefault());
    $this->assertFalse($language->isDefault());
  }

  /** * Tests sorting an array of language objects. * * @covers ::sort * * @dataProvider providerTestSortArrayOfLanguages * * @param \Drupal\Core\Language\LanguageInterface[] $languages * An array of language objects. * @param array $expected * The expected array of keys. */
case 'view':
        return parent::checkAccess($entity$operation$account);

      case 'update':
        /** @var \Drupal\Core\Language\LanguageInterface $entity */
        return AccessResult::allowedIf(!$entity->isLocked())->addCacheableDependency($entity)
          ->andIf(parent::checkAccess($entity$operation$account));

      case 'delete':
        /** @var \Drupal\Core\Language\LanguageInterface $entity */
        return AccessResult::allowedIf(!$entity->isLocked())->addCacheableDependency($entity)
          ->andIf(AccessResult::allowedIf(!$entity->isDefault())->addCacheableDependency($entity))
          ->andIf(parent::checkAccess($entity$operation$account));

      default:
        // No opinion.         return AccessResult::neutral();
    }
  }

}
public function preSave() {
    parent::preSave();

    if ($this->value == REQUEST_TIME) {
      // During a test the request time is immutable. To allow tests of the       // algorithm of       // Drupal\Core\Field\Plugin\Field\FieldType\ChangedItem::preSave() we need       // to set a real time value here. For the stability of the test, set the       // time of the original language to the current time plus just over one       // second to simulate two different request times.       // @todo mock the time service in https://www.drupal.org/node/2908210.       if ($this->getEntity()->language()->isDefault()) {
        // Wait 1.1 seconds because time_sleep_until() is not reliable.         time_sleep_until(time() + 1.1);
      }
      $this->value = time();
    }
  }

}
Home | Imprint | This part of the site doesn't use cookies.