use Drupal\Core\Entity\EntityForm;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Entity\EntityTypeInterface;
-use Symfony\Component\DependencyInjection\ContainerInterface;
-use Drupal\slick\Form\SlickAdmin;
+use Drupal\slick\Entity\Slick;
+use Drupal\slick\Form\SlickAdminInterface;
use Drupal\slick\SlickManagerInterface;
+use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* Provides base form for a slick instance configuration form.
abstract class SlickFormBase extends EntityForm {
/**
- * The slick service.
+ * The slick admin service.
*
- * @var \Drupal\slick\Form\SlickAdmin
+ * @var \Drupal\slick\Form\SlickAdminInterface
*/
protected $admin;
+ /**
+ * The slick manager service.
+ *
+ * @var \Drupal\slick\SlickManagerInterface
+ */
+ protected $manager;
+
+ /**
+ * The JS easing options.
+ *
+ * @var array
+ */
+ protected $jsEasingOptions;
+
/**
* Constructs a SlickForm object.
*/
- public function __construct(SlickAdmin $admin, SlickManagerInterface $manager) {
+ public function __construct(SlickAdminInterface $admin, SlickManagerInterface $manager) {
$this->admin = $admin;
$this->manager = $manager;
}
);
}
+ /**
+ * Returns the slick admin service.
+ */
+ public function admin() {
+ return $this->admin;
+ }
+
+ /**
+ * Returns the slick manager service.
+ */
+ public function manager() {
+ return $this->manager;
+ }
+
/**
* {@inheritdoc}
*/
return;
}
- $slick = $this->entity;
- $defaults = $slick::defaultSettings();
+ $defaults = Slick::defaultSettings();
foreach ($defaults as $name => $value) {
if (isset($settings[$name])) {
* don't support pure CSS easing.
*/
public function getJsEasingOptions() {
- $easings = &drupal_static(__METHOD__, NULL);
-
- if (!isset($easings)) {
- $easings = array(
+ if (!isset($this->jsEasingOptions)) {
+ $this->jsEasingOptions = [
'linear' => 'Linear',
'swing' => 'Swing',
'easeInQuad' => 'easeInQuad',
'easeInBounce' => 'easeInBounce',
'easeOutBounce' => 'easeOutBounce',
'easeInOutBounce' => 'easeInOutBounce',
- );
+ ];
}
- return $easings;
+ return $this->jsEasingOptions;
}
/**
*/
public function getCssEasingOptions($map = FALSE) {
$css_easings = [];
- $available_easings = array(
+ $available_easings = [
// Defaults/ Native.
'ease' => 'ease|ease',
'easeInOutExpo' => 'easeInOutExpo|cubic-bezier(1.000, 0.000, 0.000, 1.000)',
'easeInOutCirc' => 'easeInOutCirc|cubic-bezier(0.785, 0.135, 0.150, 0.860)',
'easeInOutBack' => 'easeInOutBack|cubic-bezier(0.680, -0.550, 0.265, 1.550)',
- );
+ ];
foreach ($available_easings as $key => $easing) {
list($readable_easing, $css_easing) = array_pad(array_map('trim', explode("|", $easing, 2)), 2, NULL);