You are here

class JwplayerPresetAdd in JW Player 8

Configure search settings for this site.

Hierarchy

Expanded class hierarchy of JwplayerPresetAdd

File

src/Form/JwplayerPresetAdd.php, line 11

Namespace

Drupal\jw_player\Form
View source
class JwplayerPresetAdd extends EntityForm {

  /**
   * {@inheritdoc}
   *
   * @var \Drupal\jw_player\Jw_playerInterface
   */
  protected $entity;

  /**
   * {@inheritdoc}
   */
  public function form(array $form, FormStateInterface $form_state) {
    $form = parent::form($form, $form_state);
    $preset = $this->entity;
    $form['label'] = array(
      '#type' => 'textfield',
      '#size' => 20,
      '#maxlength' => 255,
      '#title' => $this
        ->t('Preset name'),
      '#description' => $this
        ->t('Enter name for the preset.'),
      '#default_value' => $preset
        ->label(),
      '#required' => TRUE,
      '#weight' => 0,
    );
    $form['id'] = array(
      '#title' => $this
        ->t('Machine name'),
      '#type' => 'machine_name',
      '#default_value' => $preset
        ->id(),
      '#machine_name' => array(
        'exists' => array(
          $this,
          'exists',
        ),
      ),
      '#weight' => 1,
      '#description' => $this
        ->t('Enter the machine name for the preset. It must be unique and contain only alphanumeric characters and underscores.'),
    );
    $form['description'] = array(
      '#type' => 'textarea',
      '#size' => 10,
      '#title' => $this
        ->t('Description'),
      '#description' => $this
        ->t('Summary for the preset.'),
      '#default_value' => $preset->description,
      '#weight' => 2,
    );
    $form['settings'] = array(
      '#type' => 'fieldset',
      '#title' => 'Settings',
      '#tree' => TRUE,
      '#weight' => 5,
    );
    if (jw_player_use_legacy()) {
      $disabled = TRUE;
      $desc = $this
        ->t('When creating JW Player presets, select if the source should be defined on Drupal, or by using definitions set within your JWPlayer.com account. <strong>This option is only available for sites using JW Player 7 or above.</strong>');
    }
    else {
      $disabled = FALSE;
      $desc = $this
        ->t('When creating JW Player presets, select if the source should be defined on Drupal, or by using definitions set within your JWPlayer.com account.');
    }
    $form['settings']['preset_source'] = [
      '#type' => 'radios',
      '#title' => $this
        ->t('Preset source'),
      '#disabled' => $disabled,
      '#options' => [
        'drupal' => $this
          ->t('Use Drupal-defined presets'),
        'jwplayer' => $this
          ->t('Use presets defined on JWPlayer.com'),
      ],
      '#default_value' => $preset
        ->getSetting('preset_source') ? $preset
        ->getSetting('preset_source') : 'drupal',
      '#description' => $desc,
      '#weight' => 0,
    ];
    $skin_options = [];

    // Some settings are suitable for legacy versions only.
    if (jw_player_use_legacy()) {
      $form['settings']['mode'] = [
        '#type' => 'radios',
        '#title' => $this
          ->t('Embed mode'),
        '#description' => $this
          ->t('Select your primary embed mode. Choosing HTML5 primary means that modern browsers that also support flash will use the HTML5 player first where possible. While this is desirable, the Flash based player supports more features and is generally more reliable.'),
        '#options' => array(
          'flash' => $this
            ->t('Flash primary, HTML5 failover'),
          'html5' => $this
            ->t('HTML5 primary, Flash failover'),
        ),
        '#default_value' => $preset
          ->getSetting('mode') ? $preset
          ->getSetting('mode') : 'html5',
        '#weight' => 1,
        '#states' => [
          'visible' => [
            ':input[name="settings[preset_source]"]' => [
              'value' => 'drupal',
            ],
          ],
        ],
      ];

      // Legacy Skins.
      $skin_options = [
        'bekle' => 'Bekle*',
        'modieus' => 'Modieus*',
        'glow' => 'Glow*',
        'five' => 'Five*',
        'beelden' => 'Beelden*',
        'stormtrooper' => 'Stormtrooper*',
        'vapor' => 'Vapor*',
        'roundster' => 'Roundster*',
      ];
      $skin_desc = $this
        ->t('Select a player skin. Some skins (*) require a premium license.');
    }
    else {

      // JW Player 7 Skins if cloud-hosting. If self-hosting, jw_player_skins()
      // function retrieves all possible custom and library skins.
      if ($preset
        ->getSetting('jw_player_hosting') == 'cloud') {
        $skin_options = array(
          'beelden' => 'Beelden',
          'bekle' => 'Bekle',
          'five' => 'Five',
          'glow' => 'Glow',
          'roundster' => 'Roundster',
          'seven' => 'Seven',
          'six' => 'Six',
          'stormtrooper' => 'Stormtrooper',
          'vapor' => 'Vapor',
        );
      }
      $skin_url = 'https://support.jwplayer.com/customer/portal/articles/1406968-using-jw-player-skins';
      $skin_desc = $this
        ->t('Select a player skin. <a href="@url" target="_blank">Click here</a> to see skins provided by JW Player.', [
        '@url' => $skin_url,
      ]);
    }

    // For legacy, add custom skins. For newer, add only custom skins if
    // cloud-hosting, or add custom and library skins for self-hosting.
    foreach (jw_player_skins() as $skin) {
      $skin_options[$skin->name] = Unicode::ucfirst($skin->name);
    }
    $form['settings']['skin'] = [
      '#title' => $this
        ->t('Skin'),
      '#description' => $skin_desc,
      '#type' => 'select',
      '#default_value' => $preset
        ->getSetting('skin') ? $preset
        ->getSetting('skin') : FALSE,
      '#empty_option' => $this
        ->t('None (default skin)'),
      '#options' => $skin_options,
      '#weight' => 2,
      '#states' => [
        'visible' => [
          ':input[name="settings[preset_source]"]' => [
            'value' => 'drupal',
          ],
        ],
      ],
    ];
    $form['settings']['stretching'] = array(
      '#title' => $this
        ->t('Stretching'),
      '#description' => $this
        ->t('How to resize the poster and video to fit the display.'),
      '#type' => 'select',
      '#default_value' => $preset
        ->getSetting('stretching') ? $preset
        ->getSetting('stretching') : 'uniform',
      '#weight' => 3,
      '#options' => array(
        'none' => $this
          ->t('None (keep original dimensions)'),
        'exactfit' => $this
          ->t('Exact Fit (stretch disproportionally)'),
        'uniform' => $this
          ->t('Uniform (stretch proportionally; black borders)'),
        'fill' => $this
          ->t('Fill (stretch proportionally; parts cut off)'),
      ),
      '#states' => [
        'visible' => [
          ':input[name="settings[preset_source]"]' => [
            'value' => 'drupal',
          ],
        ],
      ],
    );
    $form['settings']['responsive'] = array(
      '#type' => 'checkbox',
      '#title' => 'Use a Responsive Design',
      '#description' => $this
        ->t('Enable Responsive Design using a percentage based width and an aspect ratio.'),
      '#default_value' => $preset
        ->getSetting('responsive') ? $preset
        ->getSetting('responsive') : FALSE,
      '#weight' => 4,
      '#states' => [
        'visible' => [
          ':input[name="settings[preset_source]"]' => [
            'value' => 'drupal',
          ],
        ],
      ],
    );
    $form['settings']['width'] = array(
      '#type' => 'number',
      '#min' => 1,
      '#size' => 10,
      '#title' => $this
        ->t('Width'),
      '#description' => $this
        ->t('Enter the width for this player.'),
      '#field_suffix' => ' ' . $this
        ->t('pixels'),
      '#default_value' => $preset
        ->getSetting('width') ? $preset
        ->getSetting('width') : NULL,
      '#required' => TRUE,
      '#weight' => 5,
      '#states' => [
        'required' => [
          ':input[name="settings[preset_source]"]' => [
            'value' => 'drupal',
          ],
        ],
        'visible' => [
          ':input[name="settings[preset_source]"]' => [
            'value' => 'drupal',
          ],
        ],
      ],
    );
    $form['settings']['height'] = array(
      '#type' => 'number',
      '#min' => 1,
      '#size' => 10,
      '#title' => $this
        ->t('Height'),
      '#description' => $this
        ->t('Enter the height for this player.'),
      '#field_suffix' => ' ' . $this
        ->t('pixels'),
      '#default_value' => $preset
        ->getSetting('height') ? $preset
        ->getSetting('height') : NULL,
      '#weight' => 6,
      '#states' => array(
        'required' => array(
          [
            ':input[name="settings[preset_source]"]' => [
              'value' => 'drupal',
            ],
            ':input[name="settings[responsive]"]' => [
              'checked' => FALSE,
            ],
          ],
        ),
        'visible' => array(
          ':input[name="settings[responsive]"]' => array(
            'checked' => FALSE,
          ),
          ':input[name="settings[preset_source]"]' => [
            'value' => 'drupal',
          ],
        ),
      ),
    );
    $form['settings']['aspectratio'] = array(
      '#type' => 'textfield',
      '#size' => 7,
      '#title' => $this
        ->t('Aspect ratio'),
      '#description' => $this
        ->t('Enter the aspect ratio for this player.'),
      '#default_value' => $preset
        ->getSetting('aspectratio') ? $preset
        ->getSetting('aspectratio') : NULL,
      '#weight' => 6,
      '#states' => array(
        'required' => array(
          [
            ':input[name="settings[responsive]"]' => [
              'checked' => TRUE,
            ],
            ':input[name="settings[preset_source]"]' => [
              'value' => 'drupal',
            ],
          ],
        ),
        'visible' => array(
          ':input[name="settings[responsive]"]' => array(
            'checked' => TRUE,
          ),
          ':input[name="settings[preset_source]"]' => [
            'value' => 'drupal',
          ],
        ),
      ),
    );
    $form['settings']['autostart'] = [
      '#title' => $this
        ->t('Autostart'),
      '#type' => 'checkbox',
      '#description' => $this
        ->t('Automatically start playing the video on page load. Can be true or false (default). Autostart does not work on mobile devices like iOS and Android.'),
      '#default_value' => $preset
        ->getSetting('autostart') ? $preset
        ->getSetting('autostart') : 'false',
      '#weight' => 7,
      '#states' => [
        'visible' => [
          ':input[name="settings[preset_source]"]' => [
            'value' => 'drupal',
          ],
        ],
      ],
    ];
    $form['settings']['mute'] = [
      '#type' => 'checkbox',
      '#title' => $this
        ->t('Mute'),
      '#description' => $this
        ->t('Mute the player by default during playback. This can be useful when combined with the autostart option. Cannot control settings of external sources such as YouTube.'),
      '#default_value' => $preset
        ->getSetting('mute') ? $preset
        ->getSetting('mute') : FALSE,
      '#weight' => 8,
      '#states' => [
        'visible' => [
          ':input[name="settings[preset_source]"]' => [
            'value' => 'drupal',
          ],
        ],
      ],
    ];

    // Social media sharing.
    if (!jw_player_use_legacy()) {
      $form['settings']['sharing'] = [
        '#type' => 'checkbox',
        '#title' => $this
          ->t('Sharing'),
        '#description' => $this
          ->t('Enable the social sharing overlay. If no sharing options are selected, the page URL link with default sharing sites will be shown.'),
        '#default_value' => $preset
          ->getSetting('sharing') ? $preset
          ->getSetting('sharing') : FALSE,
        '#weight' => 9,
        '#states' => [
          'visible' => [
            ':input[name="settings[preset_source]"]' => [
              'value' => 'drupal',
            ],
          ],
        ],
      ];
      $form['settings']['sharing_heading'] = [
        '#type' => 'textfield',
        '#title' => $this
          ->t('Sharing heading text'),
        '#description' => $this
          ->t('Short, instructive text to display at the top of the sharing screen.'),
        '#default_value' => $preset
          ->getSetting('sharing_heading') ? $preset
          ->getSetting('sharing_heading') : t('Share Video'),
        '#weight' => 10,
        '#states' => [
          'visible' => [
            ':input[name="settings[sharing]"]' => [
              'checked' => TRUE,
            ],
            ':input[name="settings[preset_source]"]' => [
              'value' => 'drupal',
            ],
          ],
        ],
      ];
      $sites = jw_player_sharing_sites();
      $weight = count($sites) + 1;
      $sharing_sites_order = [];
      foreach ($sites as $site_id => $sharing_site) {
        $sharing_sites_order[$site_id] = [
          'label' => $sharing_site,
          'enabled' => $preset
            ->getSetting('sharing_sites')['sites'][$site_id]['enabled'] ?? FALSE,
          'weight' => $preset
            ->getSetting('sharing_sites')['sites'][$site_id]['weight'] ?? $weight,
        ];
        $weight++;
      }
      $form['settings']['sharing_sites'] = [
        '#type' => 'item',
        '#weight' => 11,
      ];
      $form['settings']['sharing_sites']['sites'] = [
        '#type' => 'table',
        '#header' => [
          $this
            ->t('Label'),
          t('Weight'),
        ],
        '#empty' => $this
          ->t('There are no items yet. Add an item.'),
        '#suffix' => '<div class="description">' . $this
          ->t('The social networks sites that are enabled for sharing. Select none to allow all sharing sites.') . '</div>',
        '#tabledrag' => [
          [
            'action' => 'order',
            'relationship' => 'sibling',
            'group' => 'jw-player-sharing-sites-order-weight',
          ],
        ],
        '#states' => [
          'visible' => [
            ':input[name="settings[sharing]"]' => [
              'checked' => TRUE,
            ],
            ':input[name="settings[preset_source]"]' => [
              'value' => 'drupal',
            ],
          ],
        ],
      ];
      uasort($sharing_sites_order, 'Drupal\\Component\\Utility\\SortArray::sortByWeightElement');
      foreach ($sharing_sites_order as $site_id => $sharing_site) {
        $form['settings']['sharing_sites']['sites'][$site_id]['#attributes']['class'][] = 'draggable';
        $form['settings']['sharing_sites']['sites'][$site_id]['enabled'] = [
          '#type' => 'checkbox',
          '#title' => $sharing_site['label'],
          '#title_display' => 'after',
          '#default_value' => $sharing_site['enabled'],
        ];
        $form['settings']['sharing_sites']['sites'][$site_id]['weight'] = [
          '#type' => 'weight',
          '#title' => $this
            ->t('Weight for @title', [
            '@title' => $sharing_site['label'],
          ]),
          '#title_display' => 'invisible',
          '#delta' => 50,
          '#default_value' => (int) $sharing_site['weight'],
          '#array_parents' => [
            'settings',
            'sites',
            $site_id,
          ],
          '#attributes' => [
            'class' => [
              'jw-player-sharing-sites-order-weight',
            ],
          ],
        ];
      }
    }
    $form['settings']['controlbar'] = array(
      '#title' => $this
        ->t('Controlbar Position'),
      '#type' => 'select',
      '#description' => $this
        ->t('Where the controlbar should be positioned.'),
      '#default_value' => $preset
        ->getSetting('controlbar') ? $preset
        ->getSetting('controlbar') : 'none',
      '#options' => array(
        'none' => $this
          ->t('None'),
        'bottom' => $this
          ->t('Bottom'),
        'top' => $this
          ->t('Top'),
        'over' => $this
          ->t('Over'),
      ),
      '#weight' => 12,
      '#states' => [
        'visible' => [
          ':input[name="settings[preset_source]"]' => [
            'value' => 'drupal',
          ],
        ],
      ],
    );

    // Add preset plugin settings.
    foreach (jw_player_preset_plugins() as $plugin => $info) {
      $form['settings']['plugins']['#weight'] = 13;

      // Fieldset per plugin.
      $form['settings']['plugins'][$plugin] = array(
        '#type' => 'fieldset',
        '#title' => $info['name'],
        '#description' => $info['description'],
        '#tree' => TRUE,
        '#weight' => 10,
        '#collapsible' => TRUE,
        '#collapsed' => FALSE,
        '#states' => [
          'visible' => [
            ':input[name="settings[preset_source]"]' => [
              'value' => 'drupal',
            ],
          ],
        ],
      );

      // Enable/disable plugin setting.
      $form['settings']['plugins'][$plugin]['enable'] = array(
        '#type' => 'checkbox',
        '#title' => $this
          ->t('Enable'),
        '#description' => $info['description'],
      );

      // Add each config option specified in the plugin. Config options should
      // be in FAPI structure.
      if (is_array($info['config options']) and !empty($info['config options'])) {
        foreach ($info['config options'] as $option => $element) {

          // Note: Each config option must be a complete FAPI element, except
          // for the #title which is optional. If the #title is not provided, we
          // use the name of the config option as the title.
          if (!isset($element['#title'])) {
            $element['#title'] = Unicode::ucfirst($option);
          }

          // Alter the default value if a setting has been saved previously.
          $element['#default_value'] = !empty($preset['plugins'][$plugin][$option]) ? $preset['plugins'][$plugin][$option] : $element['#default_value'];

          // Make the whole element visible only if the plugin is checked
          // (enabled).
          $element['#states'] = array(
            'visible' => array(
              'input[name="settings[plugins][' . $plugin . '][enable]"]' => array(
                'checked' => TRUE,
              ),
            ),
          );

          // Add the element to the FAPI structure.
          $form['settings']['plugins'][$plugin][$option] = $element;
        }
      }
    }
    $form['settings']['advertising'] = array(
      '#type' => 'details',
      '#title' => $this
        ->t('Advertising'),
      '#description' => $this
        ->t('This requires an enterprise license. See the <a href="@jwplayer_documentation_url">JW Player documentation</a> about preroll ads for more information'),
      '#weight' => 14,
      '#states' => [
        'visible' => [
          ':input[name="settings[preset_source]"]' => [
            'value' => 'drupal',
          ],
        ],
      ],
    );
    $form['settings']['advertising']['client'] = array(
      '#type' => 'select',
      '#title' => $this
        ->t('Client'),
      '#options' => array(
        'vast' => $this
          ->t('VAST/VPAID'),
        'googima' => $this
          ->t('Google IMA Preroll'),
      ),
      '#empty_option' => $this
        ->t('No advertising'),
      '#default_value' => !empty($preset
        ->getSetting('advertising')['client']) ? $preset
        ->getSetting('advertising')['client'] : NULL,
    );
    $form['settings']['advertising']['tag'] = array(
      '#type' => 'textfield',
      '#title' => $this
        ->t('Pre Tag'),
      '#maxlength' => 1024,
      '#description' => $this
        ->t('Set this to the URL of the ad tag that contains the pre-roll ad.'),
      '#default_value' => !empty($preset
        ->getSetting([
        'advertising',
        'tag',
      ])) ? $preset
        ->getSetting([
        'advertising',
        'tag',
      ]) : NULL,
      '#states' => array(
        'invisible' => array(
          ':input[name="settings[advertising][client]"]' => array(
            'value' => '',
          ),
        ),
      ),
    );
    $form['settings']['advertising']['tag_post'] = [
      '#type' => 'textfield',
      '#title' => $this
        ->t('Post Tag'),
      '#maxlength' => 1024,
      '#description' => $this
        ->t('Set this to the URL of the ad tag that contains the post-roll ad.'),
      '#default_value' => !empty($preset
        ->getSetting([
        'advertising',
        'tag_post',
      ])) ? $preset
        ->getSetting([
        'advertising',
        'tag_post',
      ]) : NULL,
      '#states' => [
        'invisible' => [
          ':input[name="settings[advertising][client]"]' => [
            'value' => '',
          ],
        ],
      ],
    ];
    $form['settings']['advertising']['skipoffset'] = [
      '#type' => 'number',
      '#title' => $this
        ->t('Skip offset'),
      '#description' => $this
        ->t('Add skip offset in VAST adds.'),
      '#default_value' => $preset
        ->getSetting([
        'advertising',
        'skipoffset',
      ]),
      '#weight' => 5,
      '#states' => [
        'invisible' => [
          ':input[name="settings[advertising][client]"]' => [
            'value' => '',
          ],
        ],
      ],
    ];
    $form['settings']['advertising']['skipmessage'] = [
      '#type' => 'textfield',
      '#title' => $this
        ->t('Skip message'),
      '#description' => $this
        ->t('Customized countdown message. If empty message is "Skip ad in xx"'),
      '#default_value' => $preset
        ->getSetting([
        'advertising',
        'skipmessage',
      ]),
      '#weight' => 6,
      '#states' => [
        'invisible' => [
          ':input[name="settings[advertising][client]"]' => [
            'value' => '',
          ],
        ],
      ],
    ];
    $form['settings']['advertising']['skiptext'] = [
      '#type' => 'textfield',
      '#title' => $this
        ->t('Skip text'),
      '#description' => $this
        ->t('Text of the Skip button after the countdown is over. If empty text is "Skip"'),
      '#default_value' => $preset
        ->getSetting([
        'advertising',
        'skiptext',
      ]),
      '#weight' => 7,
      '#states' => [
        'invisible' => [
          ':input[name="settings[advertising][client]"]' => [
            'value' => '',
          ],
        ],
      ],
    ];
    $form['settings']['player_library_url'] = [
      '#type' => 'textfield',
      '#title' => $this
        ->t('Cloud Player Library Url'),
      '#description' => $this
        ->t('Enter the URL to the player created on JWPlayer.com that contains the settings for this preset.'),
      '#default_value' => $preset
        ->getSetting('player_library_url') ?: FALSE,
      '#states' => [
        'required' => [
          ':input[name="settings[preset_source]"]' => [
            'value' => 'jwplayer',
          ],
        ],
        'visible' => [
          ':input[name="settings[preset_source]"]' => [
            'value' => 'jwplayer',
          ],
        ],
      ],
    ];
    $form['#attached']['library'][] = 'jw_player/preset';
    return $form;
  }

  /**
   * {@inheritdoc}
   */
  public function exists($machine_name) {
    return (bool) $this->entityTypeManager
      ->getStorage('jw_player')
      ->getQuery()
      ->condition('id', $machine_name)
      ->execute();
  }

  /**
   * {@inheritdoc}
   */
  public function validateForm(array &$form, FormStateInterface $form_state) {
    parent::validateForm($form, $form_state);
    $preset = $this->entity;
    if ($preset
      ->getSetting('preset_source') == 'drupal') {
      if (!$preset
        ->getSetting('width')) {
        $form_state
          ->setErrorByName('settings][width', t('Width field is required.'));
      }
      if ($preset
        ->getSetting('responsive')) {
        if ($preset
          ->getSetting('width') > 100) {
          $form_state
            ->setErrorByName('settings][width', t('Width field must be less than 100%.'));
        }

        // Aspect Ratio Validation.
        if (!$preset
          ->getSetting('aspectratio')) {
          $form_state
            ->setErrorByName('settings][aspectratio', t('Aspect Ratio field is required if Responsive Design is enabled.'));
        }
        elseif (!preg_match('/^([0-9]*):([0-9]*)$/', $preset
          ->getSetting('aspectratio'), $matches) || (!is_numeric($matches[1]) || !is_numeric($matches[2]))) {
          $form_state
            ->setErrorByName('settings][aspectratio', $this
            ->t('Aspect Ratio field must be of the format of two numbers separated by a colon. For example, <em>16:9</em>.'));
        }
      }
      elseif (!$preset
        ->getSetting('height')) {
        $form_state
          ->setErrorByName('settings][height', t('Height field is required.'));
      }
    }
    else {
      preg_match(jw_player_library_url_regex(), $preset
        ->getSetting('player_library_url'), $matches);
      if (!isset($matches[2])) {
        $form_state
          ->setErrorByName('settings][player_library_url', t('Player Library URL does not match format provided by JWPlayer.com.'));
      }
    }
  }

  /**
   * {@inheritdoc}
   */
  public function save(array $form, FormStateInterface $form_state) {
    $preset = $this->entity;
    if ($preset
      ->getSetting('responsive')) {
      unset($preset->settings['height']);
    }
    else {
      unset($preset->settings['aspectratio']);
    }
    if (!$preset
      ->getSetting('sharing')) {
      unset($preset->settings['sharing_heading']);
      unset($preset->settings['sharing_sites']);
    }
    if ($preset
      ->getSetting('preset_source') == 'jwplayer') {
      foreach ($preset
        ->getSettings() as $key => $value) {
        if ($key != 'preset_source' && $key != 'player_library_url') {
          unset($preset->settings[$key]);
        }
      }
    }
    else {
      unset($preset->settings['player_library_url']);
    }
    $preset
      ->save();
    $this
      ->messenger()
      ->addStatus($this
      ->t('Saved the %label Preset.', array(
      '%label' => $preset
        ->label(),
    )));
    $form_state
      ->setRedirect('entity.jw_player.collection');
  }

}

Members

Namesort descending Modifiers Type Description Overrides
DependencySerializationTrait::$_entityStorages protected property An array of entity type IDs keyed by the property name of their storages.
DependencySerializationTrait::$_serviceIds protected property An array of service IDs keyed by property name used for serialization.
DependencySerializationTrait::__sleep public function 1
DependencySerializationTrait::__wakeup public function 2
EntityForm::$entityTypeManager protected property The entity type manager. 3
EntityForm::$moduleHandler protected property The module handler service.
EntityForm::$operation protected property The name of the current operation.
EntityForm::$privateEntityManager private property The entity manager.
EntityForm::actions protected function Returns an array of supported actions for the current entity form. 29
EntityForm::actionsElement protected function Returns the action form element for the current entity form.
EntityForm::afterBuild public function Form element #after_build callback: Updates the entity with submitted data.
EntityForm::buildEntity public function Builds an updated entity object based upon the submitted form values. Overrides EntityFormInterface::buildEntity 2
EntityForm::buildForm public function Form constructor. Overrides FormInterface::buildForm 10
EntityForm::copyFormValuesToEntity protected function Copies top-level form values to entity properties 7
EntityForm::getBaseFormId public function Returns a string identifying the base form. Overrides BaseFormIdInterface::getBaseFormId 5
EntityForm::getEntity public function Gets the form entity. Overrides EntityFormInterface::getEntity
EntityForm::getEntityFromRouteMatch public function Determines which entity will be used by this form from a RouteMatch object. Overrides EntityFormInterface::getEntityFromRouteMatch 1
EntityForm::getFormId public function Returns a unique string identifying the form. Overrides FormInterface::getFormId 10
EntityForm::getOperation public function Gets the operation identifying the form. Overrides EntityFormInterface::getOperation
EntityForm::init protected function Initialize the form state and the entity before the first form build. 3
EntityForm::prepareEntity protected function Prepares the entity object before the form is built first. 3
EntityForm::prepareInvokeAll protected function Invokes the specified prepare hook variant.
EntityForm::processForm public function Process callback: assigns weights and hides extra fields.
EntityForm::setEntity public function Sets the form entity. Overrides EntityFormInterface::setEntity
EntityForm::setEntityManager public function Sets the entity manager for this form. Overrides EntityFormInterface::setEntityManager
EntityForm::setEntityTypeManager public function Sets the entity type manager for this form. Overrides EntityFormInterface::setEntityTypeManager
EntityForm::setModuleHandler public function Sets the module handler for this form. Overrides EntityFormInterface::setModuleHandler
EntityForm::setOperation public function Sets the operation for this form. Overrides EntityFormInterface::setOperation
EntityForm::submitForm public function This is the default entity object builder function. It is called before any other submit handler to build the new entity object to be used by the following submit handlers. At this point of the form workflow the entity is validated and the form state… Overrides FormInterface::submitForm 17
EntityForm::__get public function
EntityForm::__set public function
FormBase::$configFactory protected property The config factory. 1
FormBase::$requestStack protected property The request stack. 1
FormBase::$routeMatch protected property The route match.
FormBase::config protected function Retrieves a configuration object.
FormBase::configFactory protected function Gets the config factory for this form. 1
FormBase::container private function Returns the service container.
FormBase::create public static function Instantiates a new instance of this class. Overrides ContainerInjectionInterface::create 87
FormBase::currentUser protected function Gets the current user.
FormBase::getRequest protected function Gets the request object.
FormBase::getRouteMatch protected function Gets the route match.
FormBase::logger protected function Gets the logger for a specific channel.
FormBase::redirect protected function Returns a redirect response object for the specified route. Overrides UrlGeneratorTrait::redirect
FormBase::resetConfigFactory public function Resets the configuration factory.
FormBase::setConfigFactory public function Sets the config factory for this form.
FormBase::setRequestStack public function Sets the request stack object to use.
JwplayerPresetAdd::$entity protected property Overrides EntityForm::$entity
JwplayerPresetAdd::exists public function
JwplayerPresetAdd::form public function Gets the actual form array to be built. Overrides EntityForm::form
JwplayerPresetAdd::save public function Form submission handler for the 'save' action. Overrides EntityForm::save
JwplayerPresetAdd::validateForm public function Form validation handler. Overrides FormBase::validateForm
LinkGeneratorTrait::$linkGenerator protected property The link generator. 1
LinkGeneratorTrait::getLinkGenerator Deprecated protected function Returns the link generator.
LinkGeneratorTrait::l Deprecated protected function Renders a link to a route given a route name and its parameters.
LinkGeneratorTrait::setLinkGenerator Deprecated public function Sets the link generator service.
LoggerChannelTrait::$loggerFactory protected property The logger channel factory service.
LoggerChannelTrait::getLogger protected function Gets the logger for a specific channel.
LoggerChannelTrait::setLoggerFactory public function Injects the logger channel factory.
MessengerTrait::$messenger protected property The messenger. 29
MessengerTrait::messenger public function Gets the messenger. 29
MessengerTrait::setMessenger public function Sets the messenger.
RedirectDestinationTrait::$redirectDestination protected property The redirect destination service. 1
RedirectDestinationTrait::getDestinationArray protected function Prepares a 'destination' URL query parameter for use with \Drupal\Core\Url.
RedirectDestinationTrait::getRedirectDestination protected function Returns the redirect destination service.
RedirectDestinationTrait::setRedirectDestination public function Sets the redirect destination service.
StringTranslationTrait::$stringTranslation protected property The string translation service. 1
StringTranslationTrait::formatPlural protected function Formats a string containing a count of items.
StringTranslationTrait::getNumberOfPlurals protected function Returns the number of plurals supported by a given language.
StringTranslationTrait::getStringTranslation protected function Gets the string translation service.
StringTranslationTrait::setStringTranslation public function Sets the string translation service to use. 2
StringTranslationTrait::t protected function Translates a string to the current language or to a given language.
UrlGeneratorTrait::$urlGenerator protected property The url generator.
UrlGeneratorTrait::getUrlGenerator Deprecated protected function Returns the URL generator service.
UrlGeneratorTrait::setUrlGenerator Deprecated public function Sets the URL generator service.
UrlGeneratorTrait::url Deprecated protected function Generates a URL or path for a specific route based on the given parameters.