/** * Constructs a \Drupal\focal_point\FocalPointEffectBase object. * * @param array $configuration * A configuration array containing information about the plugin instance. * @param string $plugin_id * The plugin_id for the plugin instance. * @param mixed $plugin_definition * The plugin implementation definition. * @param \Psr\Log\LoggerInterface $logger * Image logger. * @param \Drupal\focal_point\FocalPointManager $focal_point_manager * Focal point manager. * @param \Drupal\crop\CropStorageInterface $crop_storage * Crop storage. * @param \Drupal\Core\Config\ImmutableConfig $focal_point_config * Focal point configuration object. * @param \Symfony\Component\HttpFoundation\Request $request * Current request object. */ public function __construct(array $configuration, $plugin_id, $plugin_definition, LoggerInterface $logger, FocalPointManager $focal_point_manager, CropStorageInterface $crop_storage, ImmutableConfig $focal_point_config, Request $request) { parent::__construct($configuration, $plugin_id, $plugin_definition, $logger); $this->focalPointManager = $focal_point_manager; $this->cropStorage = $crop_storage; $this->focalPointConfig = $focal_point_config; $this->request = $request; }
/** * {@inheritdoc} */ public function submitConfigurationForm(array &$form, FormStateInterface $form_state) { parent::submitConfigurationForm($form, $form_state); $this->configuration['upscale'] = $form_state->getValue('upscale'); }
/** * {@inheritdoc} */ public function buildConfigurationForm(array $form, FormStateInterface $form_state) { $form = parent::buildConfigurationForm($form, $form_state); $form['anchor'] = array('#type' => 'radios', '#title' => t('Anchor'), '#options' => array('left-top' => t('Top left'), 'center-top' => t('Top center'), 'right-top' => t('Top right'), 'left-center' => t('Center left'), 'center-center' => t('Center'), 'right-center' => t('Center right'), 'left-bottom' => t('Bottom left'), 'center-bottom' => t('Bottom center'), 'right-bottom' => t('Bottom right')), '#theme' => 'image_anchor', '#default_value' => $this->configuration['anchor'], '#description' => t('The part of the image that will be retained during the crop.')); return $form; }
/** * {@inheritdoc} */ public function submitConfigurationForm(array &$form, array &$form_state) { parent::submitConfigurationForm($form, $form_state); $this->configuration['upscale'] = $form_state['values']['upscale']; }