You are here

interface YamlFormInterface in YAML Form 8

Provides an interface defining a form entity.

Hierarchy

Expanded class hierarchy of YamlFormInterface

All classes that implement YamlFormInterface

38 files declare their use of YamlFormInterface
ContainerBase.php in src/Plugin/YamlFormElement/ContainerBase.php
Table.php in src/Plugin/YamlFormElement/Table.php
TestYamlFormHandler.php in tests/modules/yamlform_test/src/Plugin/YamlFormHandler/TestYamlFormHandler.php
yamlform.module in ./yamlform.module
Enables the creation of forms and questionnaires.
YamlForm.php in src/Entity/YamlForm.php

... See full list

File

src/YamlFormInterface.php, line 13

Namespace

Drupal\yamlform
View source
interface YamlFormInterface extends ConfigEntityInterface, EntityWithPluginCollectionInterface, EntityOwnerInterface {

  /**
   * Determine if the form has page or is attached to other entities.
   *
   * @return bool
   *   TRUE if the form is a page with dedicated path.
   */
  public function hasPage();

  /**
   * Determine if the form's elements include a managed_file upload element.
   *
   * @return bool
   *   TRUE if the form's elements include a managed_file upload element.
   */
  public function hasManagedFile();

  /**
   * Determine if the form is using a Flexbox layout.
   *
   * @return bool
   *   TRUE if if the form is using a Flexbox layout.
   */
  public function hasFlexboxLayout();

  /**
   * Returns the form opened status indicator.
   *
   * @return bool
   *   TRUE if the form is open to new submissions.
   */
  public function isOpen();

  /**
   * Returns the form closed status indicator.
   *
   * @return bool
   *   TRUE if the form is closed to new submissions.
   */
  public function isClosed();

  /**
   * Returns the form template indicator.
   *
   * @return bool
   *   TRUE if the form is a template and available for duplication.
   */
  public function isTemplate();

  /**
   * Returns the form confidential indicator.
   *
   * @return bool
   *   TRUE if the form is confidential .
   */
  public function isConfidential();

  /**
   * Checks if a form has submissions.
   *
   * @return bool
   *   TRUE if the form has submissions.
   */
  public function hasSubmissions();

  /**
   * Determine if the current form is translated.
   *
   * @return bool
   *   TRUE if the current form is translated.
   */
  public function hasTranslations();

  /**
   * Returns the form's description.
   *
   * @return string
   *   A form's description.
   */
  public function getDescription();

  /**
   * Sets a form's description.
   *
   * @param string $description
   *   A description.
   *
   * @return $this
   */
  public function setDescription($description);

  /**
   * Returns the form's CSS.
   *
   * @return string
   *   The form's CSS.
   */
  public function getCss();

  /**
   * Sets the form's CSS.
   *
   * @param string $css
   *   The form's CSS.
   *
   * @return $this
   */
  public function setCss($css);

  /**
   * Returns the form's JavaScript.
   *
   * @return string
   *   The form's CSS.
   */
  public function getJavaScript();

  /**
   * Sets the form's JavaScript.
   *
   * @param string $javascript
   *   The form's JavaScript.
   *
   * @return $this
   */
  public function setJavaScript($javascript);

  /**
   * Returns the form settings.
   *
   * @return array
   *   A structured array containing all the form settings.
   */
  public function getSettings();

  /**
   * Sets the form settings.
   *
   * @param array $settings
   *   The structured array containing all the form setting.
   *
   * @return $this
   */
  public function setSettings(array $settings);

  /**
   * Returns the form settings for a given key.
   *
   * @param string $key
   *   The key of the setting to retrieve.
   *
   * @return mixed
   *   The settings value, or NULL if no settings exists.
   */
  public function getSetting($key);

  /**
   * Saves a form setting for a given key.
   *
   * @param string $key
   *   The key of the setting to store.
   * @param mixed $value
   *   The data to store.
   *
   * @return $this
   */
  public function setSetting($key, $value);

  /**
   * Returns the form access controls.
   *
   * @return array
   *   A structured array containing all the form access controls.
   */
  public function getAccessRules();

  /**
   * Sets the form access.
   *
   * @param array $access
   *   The structured array containing all the form access controls.
   *
   * @return $this
   */
  public function setAccessRules(array $access);

  /**
   * Returns the form default settings.
   *
   * @return array
   *   A structured array containing all the form default settings.
   */
  public static function getDefaultSettings();

  /**
   * Returns the form default access controls.
   *
   * @return array
   *   A structured array containing all the form default access controls.
   */
  public static function getDefaultAccessRules();

  /**
   * Checks form access to an operation on a form's submission.
   *
   * @param string $operation
   *   The operation access should be checked for.
   *   Usually "create", "view", "update", "delete", "purge", or "admin".
   * @param \Drupal\Core\Session\AccountInterface $account
   *   The user session for which to check access.
   * @param \Drupal\yamlform\YamlFormSubmissionInterface|null $yamlform_submission
   *   (optional) A form submission.
   *
   * @return bool
   *   The access result. Returns a TRUE if access is allowed.
   */
  public function checkAccessRules($operation, AccountInterface $account, YamlFormSubmissionInterface $yamlform_submission = NULL);

  /**
   * Get form submission form.
   *
   * @param array $values
   *   (optional) An array of values to set, keyed by property name.
   * @param string $operation
   *   (optional) The operation identifying the form variation to be returned.
   *   Defaults to 'default'. This is typically used in routing.
   *
   * @return array
   *   A render array representing a form submission form.
   */
  public function getSubmissionForm(array $values = [], $operation = 'default');

  /**
   * Get elements (YAML) value.
   *
   * @return string
   *   The elements raw value.
   */
  public function getElementsRaw();

  /**
   * Get original elements (YAML) value.
   *
   * @return string|null
   *   The original elements' raw value. Original elements is NULL for new YAML
   *   forms.
   */
  public function getElementsOriginalRaw();

  /**
   * Get form elements decoded as an associative array.
   *
   * @return array|bool
   *   Elements as an associative array. Returns FALSE is elements YAML is invalid.
   */
  public function getElementsDecoded();

  /**
   * Set element properties.
   *
   * @param string $key
   *   The element's key.
   * @param array $properties
   *   An associative array of properties.
   * @param string $parent_key
   *   (optional) The element's parent key. Only used for new elements.
   *
   * @return $this
   */
  public function setElementProperties($key, array $properties, $parent_key = '');

  /**
   * Remove an element.
   *
   * @param string $key
   *   The element's key.
   */
  public function deleteElement($key);

  /**
   * Get form elements initialized as an associative array.
   *
   * @return array|bool
   *   Elements as an associative array. Returns FALSE is elements YAML is invalid.
   */
  public function getElementsInitialized();

  /**
   * Get form raw elements decoded and flattened into an associative array.
   *
   * @return array
   *   Form raw elements decoded and flattened into an associative array
   *   keyed by element name. Returns FALSE is elements YAML is invalid.
   */
  public function getElementsDecodedAndFlattened();

  /**
   * Get form elements initialized and flattened into an associative array.
   *
   * @return array
   *   Form elements flattened into an associative array keyed by element name.
   *   Returns FALSE is elements YAML is invalid.
   */
  public function getElementsInitializedAndFlattened();

  /**
   * Get form flattened list of elements.
   *
   * @return array
   *   Form elements flattened into an associative array keyed by element name.
   */
  public function getElementsFlattenedAndHasValue();

  /**
   * Get form elements selectors as options.
   *
   * @return array
   *   Form elements selectors as options.
   */
  public function getElementsSelectorOptions();

  /**
   * Sets elements (YAML) value.
   *
   * @param array $elements
   *   An renderable array of elements.
   *
   * @return $this
   */
  public function setElements(array $elements);

  /**
   * Get a form's initialized element.
   *
   * @param string $key
   *   The element's key.
   *
   * @return array|null
   *   An associative array containing an initialized element.
   */
  public function getElement($key);

  /**
   * Get a form's raw (uninitialized) element.
   *
   * @param string $key
   *   The element's key.
   *
   * @return array|null
   *   An associative array containing an raw (uninitialized) element.
   */
  public function getElementDecoded($key);

  /**
   * Get form wizard pages.
   *
   * @return array
   *   An associative array of form pages.
   */
  public function getPages();

  /**
   * Get form wizard page.
   *
   * @param string|int $key
   *   The name/key of a form wizard page.
   *
   * @return array|null
   *   A form wizard page element.
   */
  public function getPage($key);

  /**
   * Update submit and confirm paths (ie URL aliases) associated with this form.
   */
  public function updatePaths();

  /**
   * Update submit and confirm paths associated with this form.
   */
  public function deletePaths();

  /**
   * Returns a specific form handler.
   *
   * @param string $handler_id
   *   The form handler ID.
   *
   * @return \Drupal\yamlform\YamlFormHandlerInterface
   *   The form handler object.
   */
  public function getHandler($handler_id);

  /**
   * Returns the form handlers for this form.
   *
   * @param string $plugin_id
   *   (optional) Plugin id used to return specific plugin instances
   *   (ie handlers).
   * @param bool $status
   *   (optional) Status used to return enabled or disabled plugin instances
   *   (ie handlers).
   * @param int $results
   *   (optional) Value indicating if form submissions are saved to internal or
   *   external system.
   *
   * @return \Drupal\yamlform\YamlFormHandlerPluginCollection|\Drupal\yamlform\YamlFormHandlerInterface[]
   *   The form handler plugin collection.
   */
  public function getHandlers($plugin_id = NULL, $status = NULL, $results = NULL);

  /**
   * Saves a form handler for this form.
   *
   * @param array $configuration
   *   An array of form handler configuration.
   *
   * @return string
   *   The form handler ID.
   */
  public function addYamlFormHandler(array $configuration);

  /**
   * Deletes a form handler from this style.
   *
   * @param \Drupal\yamlform\YamlFormHandlerInterface $effect
   *   The form handler object.
   *
   * @return $this
   */
  public function deleteYamlFormHandler(YamlFormHandlerInterface $effect);

  /**
   * Invoke a handlers method.
   *
   * @param string $method
   *   The handle method to be invoked.
   * @param mixed $data
   *   The argument to passed by reference to the handler method.
   */
  public function invokeHandlers($method, &$data, &$context1 = NULL, &$context2 = NULL);

  /**
   * Invoke elements method.
   *
   * @param string $method
   *   The handle method to be invoked.
   * @param mixed $data
   *   The argument to passed by reference to the handler method.
   */
  public function invokeElements($method, &$data, &$context1 = NULL, &$context2 = NULL);

  /**
   * Required to allow form which are config entities to have an EntityViewBuilder.
   *
   * Prevents:
   *   Fatal error: Call to undefined method
   *   Drupal\yamlform\Entity\YamlForm::isDefaultRevision()
   *   in /private/var/www/sites/d8_dev/core/lib/Drupal/Core/Entity/EntityViewBuilder.php
   *   on line 169
   *
   * @see \Drupal\Core\Entity\RevisionableInterface::isDefaultRevision()
   *
   * @return bool
   *   Always return TRUE since config entities are not revisionable.
   */
  public function isDefaultRevision();

  /**
   * Returns the stored value for a given key in the form's state.
   *
   * @param string $key
   *   The key of the data to retrieve.
   * @param mixed $default
   *   The default value to use if the key is not found.
   *
   * @return mixed
   *   The stored value, or NULL if no value exists.
   */
  public function getState($key, $default = NULL);

  /**
   * Saves a value for a given key in the form's state.
   *
   * @param string $key
   *   The key of the data to store.
   * @param mixed $value
   *   The data to store.
   */
  public function setState($key, $value);

  /**
   * Deletes an item from the form's state.
   *
   * @param string $key
   *   The item name to delete.
   */
  public function deleteState($key);

  /**
   * Determine if the stored value for a given key exists in the form's state.
   *
   * @param string $key
   *   The key of the data to retrieve.
   *
   * @return bool
   *   TRUE if the  stored value for a given key exists
   */
  public function hasState($key);

}

Members

Namesort descending Modifiers Type Description Overrides
AccessibleInterface::access public function Checks data value access. 9
CacheableDependencyInterface::getCacheContexts public function The cache contexts associated with this object. 34
CacheableDependencyInterface::getCacheMaxAge public function The maximum age for which this object may be cached. 34
CacheableDependencyInterface::getCacheTags public function The cache tags associated with this object. 27
ConfigEntityInterface::calculateDependencies public function Calculates dependencies and stores them in the dependency property. 2
ConfigEntityInterface::disable public function Disables the configuration entity. 2
ConfigEntityInterface::enable public function Enables the configuration entity. 2
ConfigEntityInterface::get public function Returns the value of a property. 2
ConfigEntityInterface::getDependencies public function Gets the configuration dependencies. 2
ConfigEntityInterface::hasTrustedData public function Gets whether on not the data is trusted. 2
ConfigEntityInterface::isInstallable public function Checks whether this entity is installable. 2
ConfigEntityInterface::isUninstalling public function Returns whether this entity is being changed during the uninstall process. 2
ConfigEntityInterface::onDependencyRemoval public function Informs the entity that entities it depends on will be deleted. 2
ConfigEntityInterface::set public function Sets the value of a property. 2
ConfigEntityInterface::setStatus public function Sets the status of the configuration entity. 2
ConfigEntityInterface::status public function Returns whether the configuration entity is enabled. 2
ConfigEntityInterface::trustData public function Sets that the data should be trusted. 2
EntityInterface::bundle public function Gets the bundle of the entity. 2
EntityInterface::create public static function Constructs a new entity object, without permanently saving it. 2
EntityInterface::createDuplicate public function Creates a duplicate of the entity. 2
EntityInterface::delete public function Deletes an entity permanently. 2
EntityInterface::enforceIsNew public function Enforces an entity to be new. 2
EntityInterface::getCacheTagsToInvalidate public function Returns the cache tags that should be used to invalidate caches. 2
EntityInterface::getConfigDependencyKey public function Gets the key that is used to store configuration dependencies. 2
EntityInterface::getConfigDependencyName public function Gets the configuration dependency name. 2
EntityInterface::getConfigTarget public function Gets the configuration target identifier for the entity. 2
EntityInterface::getEntityType public function Gets the entity type definition. 2
EntityInterface::getEntityTypeId public function Gets the ID of the type of the entity. 2
EntityInterface::getOriginalId public function Gets the original ID. 2
EntityInterface::getTypedData public function Gets a typed data object for this entity object. 2
EntityInterface::hasLinkTemplate public function Indicates if a link template exists for a given key. 2
EntityInterface::id public function Gets the identifier. 2
EntityInterface::isNew public function Determines whether the entity is new. 2
EntityInterface::label public function Gets the label of the entity. 2
EntityInterface::language public function Gets the language of the entity. 2
EntityInterface::link Deprecated public function Deprecated way of generating a link to the entity. See toLink(). 2
EntityInterface::load public static function Loads an entity. 2
EntityInterface::loadMultiple public static function Loads one or more entities. 2
EntityInterface::postCreate public function Acts on a created entity before hooks are invoked. 2
EntityInterface::postDelete public static function Acts on deleted entities before the delete hook is invoked. 2
EntityInterface::postLoad public static function Acts on loaded entities. 3
EntityInterface::postSave public function Acts on a saved entity before the insert or update hook is invoked. 2
EntityInterface::preCreate public static function Changes the values of an entity before it is created. 2
EntityInterface::preDelete public static function Acts on entities before they are deleted and before hooks are invoked. 2
EntityInterface::preSave public function Acts on an entity before the presave hook is invoked. 2
EntityInterface::referencedEntities public function Gets a list of entities referenced by this entity. 2
EntityInterface::save public function Saves an entity permanently. 2
EntityInterface::setOriginalId public function Sets the original ID. 2
EntityInterface::toArray public function Gets an array of all property values. 3
EntityInterface::toLink public function Generates the HTML for a link to this entity. 2
EntityInterface::toUrl public function Gets the URL object for the entity. 2
EntityInterface::uriRelationships public function Gets a list of URI relationships supported by this entity. 2
EntityInterface::url Deprecated public function Gets the public URL for this entity. 2
EntityInterface::urlInfo Deprecated public function Gets the URL object for the entity. 2
EntityInterface::uuid public function Gets the entity UUID (Universally Unique Identifier). 2
EntityOwnerInterface::getOwner public function Returns the entity owner's user entity. 1
EntityOwnerInterface::getOwnerId public function Returns the entity owner's user ID. 1
EntityOwnerInterface::setOwner public function Sets the entity owner's user entity. 1
EntityOwnerInterface::setOwnerId public function Sets the entity owner's user ID. 1
ObjectWithPluginCollectionInterface::getPluginCollections public function Gets the plugin collections used by this object. 11
RefinableCacheableDependencyInterface::addCacheableDependency public function Adds a dependency on an object: merges its cacheability metadata. 1
RefinableCacheableDependencyInterface::addCacheContexts public function Adds cache contexts. 1
RefinableCacheableDependencyInterface::addCacheTags public function Adds cache tags. 1
RefinableCacheableDependencyInterface::mergeCacheMaxAge public function Merges the maximum age (in seconds) with the existing maximum age. 1
SynchronizableInterface::isSyncing public function Returns whether this entity is being changed as part of a synchronization. 1
SynchronizableInterface::setSyncing public function Sets the status of the synchronization flag. 1
ThirdPartySettingsInterface::getThirdPartyProviders public function Gets the list of third parties that store information. 5
ThirdPartySettingsInterface::getThirdPartySetting public function Gets the value of a third-party setting. 5
ThirdPartySettingsInterface::getThirdPartySettings public function Gets all third-party settings of a given module. 5
ThirdPartySettingsInterface::setThirdPartySetting public function Sets the value of a third-party setting. 5
ThirdPartySettingsInterface::unsetThirdPartySetting public function Unsets a third-party setting. 5
YamlFormInterface::addYamlFormHandler public function Saves a form handler for this form. 1
YamlFormInterface::checkAccessRules public function Checks form access to an operation on a form's submission. 1
YamlFormInterface::deleteElement public function Remove an element. 1
YamlFormInterface::deletePaths public function Update submit and confirm paths associated with this form. 1
YamlFormInterface::deleteState public function Deletes an item from the form's state. 1
YamlFormInterface::deleteYamlFormHandler public function Deletes a form handler from this style. 1
YamlFormInterface::getAccessRules public function Returns the form access controls. 1
YamlFormInterface::getCss public function Returns the form's CSS. 1
YamlFormInterface::getDefaultAccessRules public static function Returns the form default access controls. 1
YamlFormInterface::getDefaultSettings public static function Returns the form default settings. 1
YamlFormInterface::getDescription public function Returns the form's description. 1
YamlFormInterface::getElement public function Get a form's initialized element. 1
YamlFormInterface::getElementDecoded public function Get a form's raw (uninitialized) element. 1
YamlFormInterface::getElementsDecoded public function Get form elements decoded as an associative array. 1
YamlFormInterface::getElementsDecodedAndFlattened public function Get form raw elements decoded and flattened into an associative array. 1
YamlFormInterface::getElementsFlattenedAndHasValue public function Get form flattened list of elements. 1
YamlFormInterface::getElementsInitialized public function Get form elements initialized as an associative array. 1
YamlFormInterface::getElementsInitializedAndFlattened public function Get form elements initialized and flattened into an associative array. 1
YamlFormInterface::getElementsOriginalRaw public function Get original elements (YAML) value. 1
YamlFormInterface::getElementsRaw public function Get elements (YAML) value. 1
YamlFormInterface::getElementsSelectorOptions public function Get form elements selectors as options. 1
YamlFormInterface::getHandler public function Returns a specific form handler. 1
YamlFormInterface::getHandlers public function Returns the form handlers for this form. 1
YamlFormInterface::getJavaScript public function Returns the form's JavaScript. 1
YamlFormInterface::getPage public function Get form wizard page. 1
YamlFormInterface::getPages public function Get form wizard pages. 1
YamlFormInterface::getSetting public function Returns the form settings for a given key. 1
YamlFormInterface::getSettings public function Returns the form settings. 1
YamlFormInterface::getState public function Returns the stored value for a given key in the form's state. 1
YamlFormInterface::getSubmissionForm public function Get form submission form. 1
YamlFormInterface::hasFlexboxLayout public function Determine if the form is using a Flexbox layout. 1
YamlFormInterface::hasManagedFile public function Determine if the form's elements include a managed_file upload element. 1
YamlFormInterface::hasPage public function Determine if the form has page or is attached to other entities. 1
YamlFormInterface::hasState public function Determine if the stored value for a given key exists in the form's state. 1
YamlFormInterface::hasSubmissions public function Checks if a form has submissions. 1
YamlFormInterface::hasTranslations public function Determine if the current form is translated. 1
YamlFormInterface::invokeElements public function Invoke elements method. 1
YamlFormInterface::invokeHandlers public function Invoke a handlers method. 1
YamlFormInterface::isClosed public function Returns the form closed status indicator. 1
YamlFormInterface::isConfidential public function Returns the form confidential indicator. 1
YamlFormInterface::isDefaultRevision public function Required to allow form which are config entities to have an EntityViewBuilder. 1
YamlFormInterface::isOpen public function Returns the form opened status indicator. 1
YamlFormInterface::isTemplate public function Returns the form template indicator. 1
YamlFormInterface::setAccessRules public function Sets the form access. 1
YamlFormInterface::setCss public function Sets the form's CSS. 1
YamlFormInterface::setDescription public function Sets a form's description. 1
YamlFormInterface::setElementProperties public function Set element properties. 1
YamlFormInterface::setElements public function Sets elements (YAML) value. 1
YamlFormInterface::setJavaScript public function Sets the form's JavaScript. 1
YamlFormInterface::setSetting public function Saves a form setting for a given key. 1
YamlFormInterface::setSettings public function Sets the form settings. 1
YamlFormInterface::setState public function Saves a value for a given key in the form's state. 1
YamlFormInterface::updatePaths public function Update submit and confirm paths (ie URL aliases) associated with this form. 1