Commit a363efa2 authored by Agnes Chisholm's avatar Agnes Chisholm
Browse files

Upgrades flexslider view style. Reverts item output back to string from render...

Upgrades flexslider view style. Reverts item output back to string from render array. Minor cleanup.
parent 924b9885
Loading
Loading
Loading
Loading
+11 −8
Original line number Diff line number Diff line
@@ -2,6 +2,8 @@
/**
 * @file
 * Contains \Drupal\flexslider_fields\Plugin\Field\FieldFormatter\FlexsliderFormatter.
 *
 * @author Agnes Chisholm <amaria@66428.no-reply.drupal.org>
 */
namespace Drupal\flexslider_fields\Plugin\Field\FieldFormatter;

@@ -47,8 +49,8 @@ public function settingsSummary() {
    $optionset = $this->loadOptionset();

    // Build the optionset summary
    $os_summary = $optionset ? $optionset->label() : t('Default settings');
    $summary[] = t('Option set: %os_summary', array('%os_summary' => $os_summary));
    $os_summary = $optionset ? $optionset->label() : $this->t('Default settings');
    $summary[] = $this->t('Option set: %os_summary', array('%os_summary' => $os_summary));

    // Add the image settings summary and return
    return array_merge($summary, parent::settingsSummary());
@@ -63,7 +65,7 @@ public function settingsForm(array $form, FormStateInterface $form_state) {
    $optionsets = flexslider_optionset_load_all();

    $element['optionset'] = array(
      '#title' => t('Option Set'),
      '#title' => $this->t('Option Set'),
      '#type' => 'select',
      '#default_value' => $this->getSetting('optionset'),
      '#options' => $optionsets,
@@ -73,11 +75,11 @@ public function settingsForm(array $form, FormStateInterface $form_state) {
      '#theme' => 'links',
      '#links' => array(
        array(
          'title' => t('Create new option set'),
          'title' => $this->t('Create new option set'),
          'url' => Url::fromRoute('entity.flexslider.add_form', array(), array('query' => \Drupal::destination()->getAsArray())),
        ),
        array(
          'title' => t('Manage option sets'),
          'title' => $this->t('Manage option sets'),
          'url' => Url::fromRoute('entity.flexslider.collection', array(), array('query' => \Drupal::destination()->getAsArray())),
        ),
      ),
@@ -92,7 +94,7 @@ public function settingsForm(array $form, FormStateInterface $form_state) {
    $field_settings = $this->getFieldSettings();
    if (!empty($field_settings)) {
      $element['caption'] = array(
        '#title' => t('Use image title as the caption'),
        '#title' => $this->t('Use image title as the caption'),
        '#type' => 'checkbox',
      );

@@ -111,7 +113,7 @@ public function settingsForm(array $form, FormStateInterface $form_state) {

        $element['caption']['#disabled'] = TRUE;
        $element['caption']['#description'] =
            t('You need to @action for this image field to be able to use it as a caption.',
          $this->t('You need to @action for this image field to be able to use it as a caption.',
              array('@action' => render($action->toRenderable())));
      }
      else {
@@ -153,7 +155,8 @@ public function viewElements(FieldItemListInterface $items, $langcode) {

      // Prepare the slide item render array
      $item = array();
      $item['slide'] = $image;
      // @todo Should find a way of dealing with render arrays instead of the actual output
      $item['slide'] = render($image);

      // Check caption settings
      if ($this->getSetting('caption')) {
+0 −17
Original line number Diff line number Diff line
name = FlexSlider Views Style
description = Adds a Views style plugin for FlexSlider
core = 7.x
package = FlexSlider

dependencies[] = views
dependencies[] = flexslider

files[] = flexslider_views.module
files[] = flexslider_views.views.inc
files[] = flexslider_views_plugin_style_flexslider.inc
; Information added by Drupal.org packaging script on 2015-07-30
version = "7.x-2.0-rc1"
core = "7.x"
project = "flexslider"
datestamp = "1438285141"
+8 −0
Original line number Diff line number Diff line
name: 'FlexSlider Views Style'
description: 'Adds a Views style plugin for FlexSlider'
core: 8.x
package: FlexSlider
dependencies:
  - views
  - flexslider
type: module
+0 −9
Original line number Diff line number Diff line
@@ -6,12 +6,3 @@
 *
 * @author Mathew Winstone <mwinstone@coldfrontlabs.ca>
 */

/**
 * Implements hook_views_api().
 */
function flexslider_views_views_api() {
  return array(
    'api' => 3,
  );
}
 No newline at end of file
+0 −31
Original line number Diff line number Diff line
<?php
/**
 * @file
 * Contains core functions for the Views module support.
 */

/*
 * Implements hook_views_plugins().
 *
 * This function annnounces the style plugin for flexslider views.
 */
function flexslider_views_views_plugins() {
  return array(
    'style' => array(
      // Style plugin for the FlexSlider.
      'flexslider' => array(
        'title' => t('FlexSlider'),
        'help' => t('Display the results in a FlexSlider widget.'),
        'handler' => 'flexslider_views_plugin_style_flexslider',
        'theme' => 'flexslider_views',
        'theme file' => 'flexslider_views.theme.inc',
        'theme path' => drupal_get_path('module', 'flexslider_views') . '/theme',
        'uses row plugin' => TRUE,
        'uses fields' => TRUE,
        'uses options' => TRUE,
        'type' => 'normal',
        'even empty' => FALSE,
      ),
    ),
  );
}
Loading