3 namespace Drupal\paragraphs;
5 use Drupal\user\EntityOwnerInterface;
6 use Drupal\Core\Entity\ContentEntityInterface;
7 use Drupal\entity_reference_revisions\EntityNeedsSaveInterface;
10 * Provides an interface defining a paragraphs entity.
13 interface ParagraphInterface extends ContentEntityInterface, EntityOwnerInterface, EntityNeedsSaveInterface {
16 * Gets the parent entity of the paragraph.
18 * Preserves language context with translated entities.
20 * @return ContentEntityInterface
23 public function getParentEntity();
26 * Returns short summary for paragraph.
28 * @param array $options
29 * (optional) Array of additional options, with the following elements:
30 * - 'show_behavior_summary': Whether the summary should contain the
31 * behavior settings. Defaults to TRUE to show behavior settings in the
33 * - 'depth_limit': Depth limit of how many nested paragraph summaries are
34 * allowed. Defaults to 1 to show nested paragraphs only on top level.
37 * The text without tags.
39 public function getSummary(array $options = []);
42 * Returns a flag whether a current revision has been changed.
44 * The current instance is being compared with the latest saved revision.
47 * TRUE in case the current revision changed. Otherwise, FALSE.
49 * @see \Drupal\Core\Entity\ContentEntityBase::hasTranslationChanges()
51 public function isChanged();
54 * Returns the paragraph type / bundle name as string.
57 * The Paragraph bundle name.
59 public function getType();
62 * Returns the paragraph type.
64 * @return ParagraphsTypeInterface
67 public function getParagraphType();
70 * Gets all the behavior settings.
73 * The array of behavior settings.
75 public function getAllBehaviorSettings();
78 * Gets the behavior setting of an specific plugin.
80 * @param string $plugin_id
81 * The plugin ID for which to get the settings.
82 * @param string|array $key
83 * Values are stored as a multi-dimensional associative array. If $key is a
84 * string, it will return $values[$key]. If $key is an array, each element
85 * of the array will be used as a nested key. If $key = array('foo', 'bar')
86 * it will return $values['foo']['bar'].
87 * @param mixed $default
88 * (optional) The default value if the specified key does not exist.
91 * The value for the given key.
93 public function &getBehaviorSetting($plugin_id, $key, $default = NULL);
96 * Sets all the behavior settings of a plugin.
98 * @param array $settings
99 * The behavior settings from the form.
101 public function setAllBehaviorSettings(array $settings);
104 * Sets the behavior settings of a plugin.
106 * @param string $plugin_id
107 * The plugin ID for which to set the settings.
108 * @param array $settings
109 * The behavior settings from the form.
111 public function setBehaviorSettings($plugin_id, array $settings);