You are here

FieldBase.php in Lightgallery 8

File

src/Field/FieldBase.php
View source
<?php

namespace Drupal\lightgallery\Field;


/**
 * Field base.
 */
abstract class FieldBase implements FieldInterface {
  protected $name;
  protected $title;
  protected $type;
  protected $description;
  protected $isRequired;
  protected $group;
  protected $defaultValue;
  protected $options;

  /**
   * {@inheritdoc}
   */
  public function __construct() {
    $this->name = $this
      ->setName();
    $this->title = $this
      ->setTitle();
    $this->type = $this
      ->setType();
    $this->description = $this
      ->setDescription();
    $this->isRequired = $this
      ->setIsRequired();
    $this->group = $this
      ->setGroup();
    $this->defaultValue = $this
      ->setDefaultValue();
    $this->options = $this
      ->setOptions();
  }

  /**
   * {@inheritdoc}
   */
  public function getName() {
    return $this->name;
  }

  /**
   * {@inheritdoc}
   */
  public function getTitle() {
    return $this->title;
  }

  /**
   * {@inheritdoc}
   */
  public function getType() {
    return $this->type;
  }

  /**
   * {@inheritdoc}
   */
  public function getDescription() {
    return $this->description;
  }

  /**
   * {@inheritdoc}
   */
  public function isRequired() {
    return $this->isRequired;
  }

  /**
   * {@inheritdoc}
   */
  public function getGroup() {
    return $this->group;
  }

  /**
   * {@inheritdoc}
   */
  public function getDefaultValue() {
    return $this->defaultValue;
  }

  /**
   * {@inheritdoc}
   */
  public function appliesToViews() {
    return TRUE;
  }

  /**
   * {@inheritdoc}
   */
  public function getOptions() {
    return $this->options;
  }

  /**
   * {@inheritdoc}
   */
  public function appliesToFieldFormatter() {
    return TRUE;
  }

  /**
   * Sets required flag.
   */
  protected function setIsRequired() {
    return FALSE;
  }

  /**
   * Sets default value.
   */
  protected function setDefaultValue() {
    return TRUE;
  }

  /**
   * Sets options.
   */
  protected function setOptions() {
    return FALSE;
  }

  /**
   * Sets name.
   */
  protected abstract function setName();

  /**
   * Sets title.
   */
  protected abstract function setTitle();

  /**
   * Sets type.
   */
  protected abstract function setType();

  /**
   * Sets description.
   */
  protected abstract function setDescription();

  /**
   * Sets group.
   */
  protected abstract function setGroup();

}

Classes

Namesort descending Description
FieldBase Field base.