Upgraded imagemagick and manually altered pdf to image module to handle changes....
[yaffs-website] / web / modules / contrib / paragraphs / src / ParagraphStorageSchema.php
1 <?php
2
3 namespace Drupal\paragraphs;
4
5 use Drupal\Core\Entity\ContentEntityTypeInterface;
6 use Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema;
7 use Drupal\Core\Field\FieldStorageDefinitionInterface;
8
9 /**
10  * Extends the paragraphs schema handler.
11  */
12 class ParagraphStorageSchema extends SqlContentEntityStorageSchema {
13
14   /**
15    * {@inheritdoc}
16    */
17   protected function getEntitySchema(ContentEntityTypeInterface $entity_type, $reset = FALSE) {
18     $schema = parent::getEntitySchema($entity_type, $reset);
19
20     $schema['paragraphs_item_field_data']['indexes'] += array(
21       'paragraphs__parent_fields' => array('parent_type', 'parent_id', 'parent_field_name'),
22     );
23
24     return $schema;
25   }
26
27   /**
28    * {@inheritdoc}
29    */
30   protected function getSharedTableFieldSchema(FieldStorageDefinitionInterface $storage_definition, $table_name, array $column_mapping) {
31     // Setting the initial value to 1 when we add a 'status' field.
32     // @todo this is a workaround for https://www.drupal.org/node/2346019
33     $schema = parent::getSharedTableFieldSchema($storage_definition, $table_name, $column_mapping);
34     if ($storage_definition->getName() == 'status') {
35       $schema['fields']['status']['initial'] = 1;
36     }
37
38     if ($storage_definition->getName() == 'behavior_settings') {
39       $schema['fields']['behavior_settings']['initial'] = serialize([]);
40     }
41     return $schema;
42   }
43 }