/**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     $this->fileSystem = $this->container->get('file_system');
     $this->config('system.file')->set('default_scheme', 'public')->save();
     $this->imageStyle = ImageStyle::create(['name' => 'test']);
     $this->imageStyle->save();
 }
 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     $this->style = ImageStyle::create(['name' => 'style_foo', 'label' => $this->randomString()]);
     $this->style->save();
     $this->replacementStyle = ImageStyle::create(['name' => 'style_bar', 'label' => $this->randomString()]);
     $this->replacementStyle->save();
     $this->entityTypeManager = \Drupal::entityTypeManager();
 }
예제 #3
0
  /**
   * {@inheritdoc}
   */
  protected function setUp() {
    parent::setUp();

    $this->adminUser = $this->drupalCreateUser(['administer crop types', 'administer image styles']);

    // Create test image style.
    $this->testStyle = $this->container->get('entity.manager')->getStorage('image_style')->create([
      'name' => 'test',
      'label' => 'Test image style',
      'effects' => [],
    ]);
    $this->testStyle->save();
  }
예제 #4
0
 /**
  * {@inheritdoc}
  */
 public function submitForm(array &$form, FormStateInterface $form_state)
 {
     $form_state->cleanValues();
     // The image effect configuration is stored in the 'data' key in the form,
     // pass that through for submission.
     $this->imageEffect->submitConfigurationForm($form['data'], SubformState::createForSubform($form['data'], $form, $form_state));
     $this->imageEffect->setWeight($form_state->getValue('weight'));
     if (!$this->imageEffect->getUuid()) {
         $this->imageStyle->addImageEffect($this->imageEffect->getConfiguration());
     }
     $this->imageStyle->save();
     drupal_set_message($this->t('The image effect was successfully applied.'));
     $form_state->setRedirectUrl($this->imageStyle->urlInfo('edit-form'));
 }
예제 #5
0
 /**
  * {@inheritdoc}
  */
 public function submitForm(array &$form, array &$form_state)
 {
     form_state_values_clean($form_state);
     // The image effect configuration is stored in the 'data' key in the form,
     // pass that through for submission.
     $effect_data = array('values' => &$form_state['values']['data']);
     $this->imageEffect->submitConfigurationForm($form, $effect_data);
     $this->imageEffect->setWeight($form_state['values']['weight']);
     if (!$this->imageEffect->getUuid()) {
         $this->imageStyle->addImageEffect($this->imageEffect->getConfiguration());
     }
     $this->imageStyle->save();
     drupal_set_message($this->t('The image effect was successfully applied.'));
     $form_state['redirect_route'] = $this->imageStyle->urlInfo('edit-form');
 }
예제 #6
0
  /**
   * {@inheritdoc}
   */
  protected function setUp() {
    parent::setUp();

    /** @var \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager */
    $entity_type_manager = $this->container->get('entity_type.manager');
    $this->cropStorage = $entity_type_manager->getStorage('crop');
    $this->cropTypeStorage = $entity_type_manager->getStorage('crop_type');
    $this->imageStyleStorage = $entity_type_manager->getStorage('image_style');
    $this->fileStorage = $entity_type_manager->getStorage('file');

    // Create DB schemas.
    /** @var \Drupal\Core\Entity\EntityTypeListenerInterface $entity_type_listener */
    $entity_type_listener = $this->container->get('entity_type.listener');
    $entity_type_listener->onEntityTypeCreate($entity_type_manager->getDefinition('user'));
    $entity_type_listener->onEntityTypeCreate($entity_type_manager->getDefinition('image_style'));
    $entity_type_listener->onEntityTypeCreate($entity_type_manager->getDefinition('crop'));
    $entity_type_listener->onEntityTypeCreate($entity_type_manager->getDefinition('file'));

    // Create test image style.
    $uuid = $this->container->get('uuid')->generate();
    $this->testStyle = $this->imageStyleStorage->create([
      'name' => 'test',
      'label' => 'Test image style',
      'effects' => [
        $uuid => [
          'id' => 'crop_crop',
          'data' => ['crop_type' => 'test_type'],
          'weight' => 0,
          'uuid' => $uuid,
        ]
      ],
    ]);
    $this->testStyle->save();

    // Create test crop type.
    $this->cropType = $this->cropTypeStorage->create([
      'id' => 'test_type',
      'label' => 'Test crop type',
      'description' => 'Some nice desc.',
    ]);
    $this->cropType->save();
  }
 protected function setUp()
 {
     parent::setUp();
     $this->style = ImageStyle::create(array('name' => 'style_foo', 'label' => $this->randomString()));
     $this->style->save();
 }
 protected function setUp()
 {
     parent::setUp();
     $this->style = entity_create('image_style', array('name' => 'style_foo', 'label' => $this->randomString()));
     $this->style->save();
 }
예제 #9
0
 /**
  * {@inheritdoc}
  */
 public function save(array $form, FormStateInterface $form_state)
 {
     $this->entity->save();
     $form_state->setRedirectUrl($this->entity->urlInfo('edit-form'));
 }
예제 #10
0
 /**
  * {@inheritdoc}
  */
 public function save(array $form, array &$form_state)
 {
     $this->entity->save();
     $form_state['redirect_route'] = $this->entity->urlInfo('edit-form');
 }