You are here

protected function EntityViewDisplayEditForm::getApplicablePluginOptions in Facebook Instant Articles 3.x

Same name and namespace in other branches
  1. 8.2 src/Form/EntityViewDisplayEditForm.php \Drupal\fb_instant_articles\Form\EntityViewDisplayEditForm::getApplicablePluginOptions()

Returns an array of applicable widget or formatter options for a field.

Parameters

\Drupal\Core\Field\FieldDefinitionInterface $field_definition: The field definition.

Return value

array An array of applicable widget or formatter options.

Overrides EntityDisplayFormBase::getApplicablePluginOptions

File

src/Form/EntityViewDisplayEditForm.php, line 46

Class

EntityViewDisplayEditForm
Extends the core EntityViewDisplayEditForm to support multiple regions.

Namespace

Drupal\fb_instant_articles\Form

Code

protected function getApplicablePluginOptions(FieldDefinitionInterface $field_definition) {
  $options = parent::getApplicablePluginOptions($field_definition);

  // Filter out FBIA formatters for view modes other than the Facebook instant
  // articles view mode.
  if ($this
    ->getEntity()
    ->getOriginalMode() !== 'fb_instant_articles') {
    foreach ($options as $key => $label) {
      if (preg_match('/^fbia_/', $key)) {
        unset($options[$key]);
      }
    }
  }
  return $options;
}