/** * Constructs a ContactFormFormatter instance. * * @param string $plugin_id * The plugin_id for the formatter. * @param mixed $plugin_definition * The plugin implementation definition. * @param \Drupal\Core\Field\FieldDefinitionInterface $field_definition * The definition of the field to which the formatter is associated. * @param array $settings * The formatter settings. * @param string $label * The formatter label display setting. * @param string $view_mode * The view mode. * @param array $third_party_settings * Any third party settings settings. * @param \Drupal\Core\Render\RendererInterface $renderer * The renderer. * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory * The config factory. * @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager * The entity manager. * @param \Drupal\Core\Entity\EntityFormBuilderInterface $entity_form_builder * The entity form builder. */ public function __construct($plugin_id, $plugin_definition, FieldDefinitionInterface $field_definition, array $settings, $label, $view_mode, array $third_party_settings, RendererInterface $renderer, ConfigFactoryInterface $config_factory, EntityManagerInterface $entity_manager, EntityFormBuilderInterface $entity_form_builder) { parent::__construct($plugin_id, $plugin_definition, $field_definition, $settings, $label, $view_mode, $third_party_settings); $this->renderer = $renderer; $this->configFactory = $config_factory; $this->entityManager = $entity_manager; $this->entityFormBuilder = $entity_form_builder; }
/** * {@inheritdoc} */ public static function defaultSettings() { return array('view_mode' => 'default', 'link' => FALSE) + parent::defaultSettings(); }
/** * {@inheritdoc} */ protected function needsEntityLoad(EntityReferenceItem $item) { return parent::needsEntityLoad($item) && $item->isDisplayed(); }
/** * {@inheritdoc} */ public static function defaultSettings() { return array('link' => TRUE) + parent::defaultSettings(); }
/** * {@inheritdoc} */ public function settingsForm(array $form, FormStateInterface $form_state) { $image_styles = image_style_options(FALSE); $description_link = Link::fromTextAndUrl($this->t('Configure Image Styles'), Url::fromRoute('entity.image_style.collection')); $element['image_style'] = ['#title' => t('Image style'), '#type' => 'select', '#default_value' => $this->getSetting('image_style'), '#empty_option' => t('None (original image)'), '#options' => $image_styles, '#description' => $description_link->toRenderable() + ['#access' => $this->currentUser->hasPermission('administer image styles')]]; $link_types = array('content' => t('Content'), 'file' => t('File')); $element['image_link'] = array('#title' => t('Link image to'), '#type' => 'select', '#default_value' => $this->getSetting('image_link'), '#empty_option' => t('Nothing'), '#options' => $link_types); $element['items'] = array('#type' => 'number', '#title' => $this->t('Items'), '#description' => $this->t('Maximum amount of items displayed at a time with the widest browser width.'), '#default_value' => $this->getSetting('items')); $element['itemsDesktop'] = array('#type' => 'textfield', '#title' => $this->t('Items Desktop'), '#description' => $this->t('This allows you to preset the number of slides visible with a particular browser width. The format is [x,y] whereby x=browser width and y=number of slides displayed. For example [1199,4] means that if(window<=1199){ show 4 slides per page}'), '#default_value' => $this->getSetting('itemsDesktop')); $element['itemsDesktopSmall'] = array('#type' => 'textfield', '#title' => $this->t('Items Desktop Small'), '#description' => $this->t('Example: [979,3]'), '#default_value' => $this->getSetting('itemsDesktopSmall')); $element['itemsTablet'] = array('#type' => 'textfield', '#title' => $this->t('Items Tablet'), '#description' => $this->t('Example: [768,2]'), '#default_value' => $this->getSetting('itemsTablet')); $element['itemsMobile'] = array('#type' => 'textfield', '#title' => $this->t('Items Mobile'), '#description' => $this->t('Example: [479,1]'), '#default_value' => $this->getSetting('itemsMobile')); $element['singleItem'] = array('#type' => 'checkbox', '#title' => $this->t('Single Item'), '#default_value' => $this->getSetting('singleItem'), '#description' => $this->t('Display only one item.')); //itemsScaleUp $element['itemsScaleUp'] = array('#type' => 'checkbox', '#title' => $this->t('Items ScaleUp'), '#default_value' => $this->getSetting('itemsScaleUp'), '#description' => $this->t('Option to not stretch items when it is less than the supplied items.')); //slideSpeed $element['slideSpeed'] = array('#type' => 'number', '#title' => $this->t('Slide Speed'), '#default_value' => $this->getSetting('slideSpeed'), '#description' => $this->t('Slide speed in milliseconds.')); //paginationSpeed $element['paginationSpeed'] = array('#type' => 'number', '#title' => $this->t('Pagination Speed'), '#default_value' => $this->getSetting('paginationSpeed'), '#description' => $this->t('Pagination speed in milliseconds.')); //rewindSpeed $element['rewindSpeed'] = array('#type' => 'number', '#title' => $this->t('Rewind Speed'), '#default_value' => $this->getSetting('rewindSpeed'), '#description' => $this->t('Rewind speed in milliseconds.')); //autoPlay $element['autoPlay'] = array('#type' => 'checkbox', '#title' => $this->t('AutoPlay'), '#default_value' => $this->getSetting('autoPlay')); //stopOnHover $element['stopOnHover'] = array('#type' => 'checkbox', '#title' => $this->t('Stop On Hover'), '#default_value' => $this->getSetting('stopOnHover'), '#description' => $this->t('Stop autoplay on mouse hover.')); //navigation $element['navigation'] = array('#type' => 'checkbox', '#title' => $this->t('Navigation'), '#default_value' => $this->getSetting('navigation'), '#description' => $this->t('Display "next" and "prev" buttons.')); //prevText $element['prevText'] = array('#type' => 'textfield', '#title' => $this->t('Prev Text'), '#default_value' => $this->getSetting('prevText'), '#description' => $this->t('Text for navigation prev button')); //nextText $element['nextText'] = array('#type' => 'textfield', '#title' => $this->t('Next Text'), '#default_value' => $this->getSetting('nextText'), '#description' => $this->t('Text for navigation next button')); //rewindNav $element['rewindNav'] = array('#type' => 'checkbox', '#title' => $this->t('Rewind Nav'), '#default_value' => $this->getSetting('rewindNav'), '#description' => $this->t('Slide to first item.')); //scrollPerPage $element['scrollPerPage'] = array('#type' => 'checkbox', '#title' => $this->t('Scroll Per Page'), '#default_value' => $this->getSetting('scrollPerPage'), '#description' => $this->t('Scroll per page not per item. This affect next/prev buttons and mouse/touch dragging.')); //pagination $element['pagination'] = array('#type' => 'checkbox', '#title' => $this->t('pagination'), '#default_value' => $this->getSetting('pagination'), '#description' => $this->t('Show pagination.')); //paginationNumbers $element['paginationNumbers'] = array('#type' => 'checkbox', '#title' => $this->t('Pagination Numbers'), '#default_value' => $this->getSetting('paginationNumbers'), '#description' => $this->t('Show numbers inside pagination buttons.')); //responsive $element['responsive'] = array('#type' => 'checkbox', '#title' => $this->t('Responsive'), '#default_value' => $this->getSetting('responsive'), '#description' => $this->t('Uncheck to use Owl Carousel on desktop-only.')); //responsiveRefreshRate $element['responsiveRefreshRate'] = array('#type' => 'number', '#title' => $this->t('Responsive Refresh Rate'), '#default_value' => $this->getSetting('responsiveRefreshRate'), '#description' => $this->t('Check window width changes every 200ms for responsive actions.')); //mouseDrag $element['mouseDrag'] = array('#type' => 'checkbox', '#title' => $this->t('Mouse Drag'), '#default_value' => $this->getSetting('mouseDrag'), '#description' => $this->t('Turn off/on mouse events.')); //touchDrag $element['touchDrag'] = array('#type' => 'checkbox', '#title' => $this->t('Touch Drag'), '#default_value' => $this->getSetting('touchDrag'), '#description' => $this->t('Turn off/on touch events.')); //transitionStyle $element['transitionStyle'] = array('#type' => 'select', '#options' => array('fade' => $this->t('Fade'), 'backSlide' => $this->t('Back Slide'), 'goDown' => $this->t('Go Down'), 'scaleUp' => $this->t('ScaleUp')), '#title' => $this->t('Transition Style'), '#default_value' => $this->getSetting('transitionStyle'), '#description' => $this->t('Add CSS3 transition style. Works only with one item on screen.')); return $element + parent::settingsForm($form, $form_state); }
/** * {@inheritdoc} */ public static function defaultSettings() { return ['link_to' => ''] + parent::defaultSettings(); }
/** * {@inheritdoc} */ public static function defaultSettings() { return array('link' => TRUE, 'path' => NULL, 'path_case' => 'none', 'transform_dash' => NULL) + parent::defaultSettings(); }