class MediaInlineForm in Media entity 8
Media inline form handler.
Hierarchy
- class \Drupal\inline_entity_form\Form\EntityInlineForm implements InlineFormInterface uses StringTranslationTrait
- class \Drupal\media_entity\Form\MediaInlineForm uses StringTranslationTrait
Expanded class hierarchy of MediaInlineForm
File
- src/
Form/ MediaInlineForm.php, line 12
Namespace
Drupal\media_entity\FormView source
class MediaInlineForm extends EntityInlineForm {
use StringTranslationTrait;
/**
* {@inheritdoc}
*/
public function getTableFields($bundles) {
$fields = parent::getTableFields($bundles);
unset($fields['name']);
$fields['thumbnail'] = [
'type' => 'field',
'label' => $this
->t('Thumbnail'),
'weight' => 1,
'display_options' => [
'type' => 'image',
'settings' => [
'image_style' => 'thumbnail',
],
],
];
return $fields;
}
/**
* {@inheritdoc}
*/
public function entityFormSubmit(array &$entity_form, FormStateInterface $form_state) {
parent::entityFormSubmit($entity_form, $form_state);
/** @var \Drupal\media_entity\MediaInterface $entity */
$entity = $entity_form['#entity'];
// Make sure media thumbnail is set correctly.
$entity
->automaticallySetThumbnail();
if ($entity_form['#save_entity']) {
$entity
->save();
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
EntityInlineForm:: |
protected | property | The entity field manager. | |
EntityInlineForm:: |
protected | property | The entity type managed by this handler. | |
EntityInlineForm:: |
protected | property | The entity type manager. | |
EntityInlineForm:: |
protected | property | Module handler service. | |
EntityInlineForm:: |
protected | function | Builds an updated entity object based upon the submitted form values. | |
EntityInlineForm:: |
public static | function |
Instantiates a new instance of this entity handler. Overrides EntityHandlerInterface:: |
|
EntityInlineForm:: |
public | function |
Delete permanently saved entities. Overrides InlineFormInterface:: |
|
EntityInlineForm:: |
public | function |
Builds the entity form. Overrides InlineFormInterface:: |
|
EntityInlineForm:: |
public | function |
Validates the entity form. Overrides InlineFormInterface:: |
|
EntityInlineForm:: |
public | function |
Gets the label of the given entity. Overrides InlineFormInterface:: |
|
EntityInlineForm:: |
public | function |
Gets the entity type managed by this handler. Overrides InlineFormInterface:: |
|
EntityInlineForm:: |
public | function |
Gets the entity type labels (singular, plural). Overrides InlineFormInterface:: |
1 |
EntityInlineForm:: |
protected | function | Gets the form display for the given entity. | |
EntityInlineForm:: |
public | function |
Checks whether tabledrag should be enabled for the given table. Overrides InlineFormInterface:: |
|
EntityInlineForm:: |
public | function |
Saves the given entity. Overrides InlineFormInterface:: |
|
EntityInlineForm:: |
public static | function | Cleans up the form state for a submitted entity form. | |
EntityInlineForm:: |
public | function | Constructs the inline entity form controller. | |
MediaInlineForm:: |
public | function |
Handles the submission of an entity form. Overrides EntityInlineForm:: |
|
MediaInlineForm:: |
public | function |
Gets the columns used to represent an entity in the IEF table. Overrides EntityInlineForm:: |
|
StringTranslationTrait:: |
protected | property | The string translation service. | 1 |
StringTranslationTrait:: |
protected | function | Formats a string containing a count of items. | |
StringTranslationTrait:: |
protected | function | Returns the number of plurals supported by a given language. | |
StringTranslationTrait:: |
protected | function | Gets the string translation service. | |
StringTranslationTrait:: |
public | function | Sets the string translation service to use. | 2 |
StringTranslationTrait:: |
protected | function | Translates a string to the current language or to a given language. |