Newer
Older
Angie Byron
committed
<?php
/**
* @file
* Contains \Drupal\content_translation\ContentTranslationHandlerInterface.
Angie Byron
committed
*/
Alex Pott
committed
namespace Drupal\content_translation;
Angie Byron
committed
use Drupal\Core\Entity\EntityInterface;
Dries Buytaert
committed
use Drupal\Core\Form\FormStateInterface;
Angie Byron
committed
/**
Alex Pott
committed
* Interface for providing content translation.
Angie Byron
committed
*
* Defines a set of methods to allow any entity to be processed by the entity
* translation UI.
*/
interface ContentTranslationHandlerInterface {
Angie Byron
committed
/**
* Returns a set of field definitions to be used to store metadata items.
*
* @return \Drupal\Core\Field\FieldDefinitionInterface[]
*/
public function getFieldDefinitions();
Angie Byron
committed
/**
Angie Byron
committed
* Checks if the user can perform the given operation on translations of the
* wrapped entity.
Angie Byron
committed
*
* @param \Drupal\Core\Entity\EntityInterface $entity
* The entity whose translation has to be accessed.
Angie Byron
committed
* @param $op
* The operation to be performed on the translation. Possible values are:
* - "create"
* - "update"
* - "delete"
Angie Byron
committed
*
catch
committed
* @return \Drupal\Core\Access\AccessResultInterface
* The access result.
Angie Byron
committed
*/
Angie Byron
committed
public function getTranslationAccess(EntityInterface $entity, $op);
Angie Byron
committed
/**
* Retrieves the source language for the translation being created.
*
Dries Buytaert
committed
* @param \Drupal\Core\Form\FormStateInterface $form_state
* The current state of the form.
Angie Byron
committed
*
* @return string
* The source language code.
*/
Alex Pott
committed
public function getSourceLangcode(FormStateInterface $form_state);
Angie Byron
committed
/**
* Marks translations as outdated.
*
* @param \Drupal\Core\Entity\EntityInterface $entity
* The entity being translated.
* @param string $langcode
* (optional) The language code of the updated language: all the other
* translations will be marked as outdated. Defaults to the entity language.
*/
public function retranslate(EntityInterface $entity, $langcode = NULL);
/**
* Performs the needed alterations to the entity form.
*
* @param array $form
* The entity form to be altered to provide the translation workflow.
Dries Buytaert
committed
* @param \Drupal\Core\Form\FormStateInterface $form_state
* The current state of the form.
Angie Byron
committed
* @param \Drupal\Core\Entity\EntityInterface $entity
* The entity being created or edited.
*/
Dries Buytaert
committed
public function entityFormAlter(array &$form, FormStateInterface $form_state, EntityInterface $entity);
Alex Pott
committed