imageStyleStorage = $image_style_storage; } /** * {@inheritdoc} */ public static function create(ContainerInterface $container) { return new static( $container->get('entity.manager')->getStorage('image_style') ); } /** * {@inheritdoc} */ public function form(array $form, FormStateInterface $form_state) { $form['label'] = [ '#type' => 'textfield', '#title' => $this->t('Image style name'), '#default_value' => $this->entity->label(), '#required' => TRUE, ]; $form['name'] = [ '#type' => 'machine_name', '#machine_name' => [ 'exists' => [$this->imageStyleStorage, 'load'], ], '#default_value' => $this->entity->id(), '#required' => TRUE, ]; return parent::form($form, $form_state); } /** * {@inheritdoc} */ public function save(array $form, FormStateInterface $form_state) { parent::save($form, $form_state); $form_state->setRedirectUrl($this->entity->urlInfo('edit-form')); } }