Backup of db before drupal security update
[yaffs-website] / web / core / modules / content_translation / src / ContentTranslationHandlerInterface.php
1 <?php
2
3 namespace Drupal\content_translation;
4
5 use Drupal\Core\Entity\EntityInterface;
6 use Drupal\Core\Form\FormStateInterface;
7
8 /**
9  * Interface for providing content translation.
10  *
11  * Defines a set of methods to allow any entity to be processed by the entity
12  * translation UI.
13  */
14 interface ContentTranslationHandlerInterface {
15
16   /**
17    * Returns a set of field definitions to be used to store metadata items.
18    *
19    * @return \Drupal\Core\Field\FieldDefinitionInterface[]
20    */
21   public function getFieldDefinitions();
22
23   /**
24    * Checks if the user can perform the given operation on translations of the
25    * wrapped entity.
26    *
27    * @param \Drupal\Core\Entity\EntityInterface $entity
28    *   The entity whose translation has to be accessed.
29    * @param $op
30    *   The operation to be performed on the translation. Possible values are:
31    *   - "create"
32    *   - "update"
33    *   - "delete"
34    *
35    * @return \Drupal\Core\Access\AccessResultInterface
36    *   The access result.
37    */
38   public function getTranslationAccess(EntityInterface $entity, $op);
39
40   /**
41    * Retrieves the source language for the translation being created.
42    *
43    * @param \Drupal\Core\Form\FormStateInterface $form_state
44    *   The current state of the form.
45    *
46    * @return string
47    *   The source language code.
48    */
49   public function getSourceLangcode(FormStateInterface $form_state);
50
51   /**
52    * Marks translations as outdated.
53    *
54    * @param \Drupal\Core\Entity\EntityInterface $entity
55    *   The entity being translated.
56    * @param string $langcode
57    *   (optional) The language code of the updated language: all the other
58    *   translations will be marked as outdated. Defaults to the entity language.
59    */
60   public function retranslate(EntityInterface $entity, $langcode = NULL);
61
62   /**
63    * Performs the needed alterations to the entity form.
64    *
65    * @param array $form
66    *   The entity form to be altered to provide the translation workflow.
67    * @param \Drupal\Core\Form\FormStateInterface $form_state
68    *   The current state of the form.
69    * @param \Drupal\Core\Entity\EntityInterface $entity
70    *   The entity being created or edited.
71    */
72   public function entityFormAlter(array &$form, FormStateInterface $form_state, EntityInterface $entity);
73
74 }