Drupal 8  8.0.2
Element Class Reference

Static Public Member Functions

static property ($key)
 
static properties (array $element)
 
static child ($key)
 
static children (array &$elements, $sort=FALSE)
 
static getVisibleChildren (array $elements)
 
static isVisibleElement ($element)
 
static setAttributes (array &$element, array $map)
 
static isEmpty (array $elements)
 

Detailed Description

Provides helper methods for Drupal render elements.

See Also

Member Function Documentation

static child (   $key)
static

Checks if the key is a child.

Parameters
string$keyThe key to check.
Returns
bool TRUE if the element is a child, FALSE otherwise.

Referenced by ElementTest\testChild().

Here is the caller graph for this function:

static children ( array &  $elements,
  $sort = FALSE 
)
static

Identifies the children of an element array, optionally sorted by weight.

The children of a element array are those key/value pairs whose key does not start with a '#'. See drupal_render() for details.

Parameters
array$elementsThe element array whose children are to be identified. Passed by reference.
bool$sortBoolean to indicate whether the children should be sorted by weight.
Returns
array The array keys of the element's children.

References SafeMarkup\format().

Referenced by EntityForm\actionsElement(), ContentTranslationHandler\addTranslatabilityClue(), FormTest\assertFormValuesDefault(), FilterPluginBase\buildExposedFiltersGroupForm(), TranslateEditForm\buildForm(), FieldConfigDeleteForm\buildForm(), Overview\buildForm(), AccountSettingsForm\buildForm(), ModulesListForm\buildForm(), EntityViewBuilder\buildMultiple(), MenuForm\buildOverviewForm(), SystemMenuBlockTest\convertBuiltMenuToIdTree(), FormBuilder\doBuildForm(), Renderer\doRender(), FormValidator\doValidateForm(), WebTestBase\drupalBuildEntityView(), ContentTranslationHandler\entityFormAlter(), ContentTranslationHandler\entityFormSharedElements(), EntityReferenceItem\fieldSettingsAjaxProcessElement(), RenderCache\getCacheableRenderArray(), FormElementHelper\getElementByName(), FormElementHelper\getElementTitle(), Actions\preRenderActionsDropbutton(), PluginBase\preRenderAddFieldsetMarkup(), PluginBase\preRenderFlattenData(), RenderElement\preRenderGroup(), FieldUiTable\preRenderRegionRows(), Table\preRenderTable(), Tableselect\preRenderTableselect(), Toolbar\preRenderToolbar(), FileWidget\process(), TextFormat\processFormat(), FileWidget\processMultiple(), Table\processTable(), FormHelper\rewriteStatesSelector(), FileTransferAuthorizeForm\setConnectionSettingsDefaults(), FormErrorHandler\setElementErrorsFromFormState(), CKEditor\settingsForm(), FilterPluginBase\showBuildGroupForm(), HandlerBase\showExposeForm(), QuickEditFieldForm\simplify(), BookAdminEditForm\submitForm(), MenuForm\submitOverviewForm(), FieldUiTable\tablePreRender(), ElementTest\testChildren(), ValidationTest\testCustomRequiredError(), FormTest\testDisabledElements(), ElementTest\testIgnoredChildren(), ElementTest\testInvalidChildren(), RendererTest\testRenderCacheProperties(), RendererTest\testRenderSorting(), FileWidget\validateMultipleCount(), MessageViewBuilder\view(), and FormatterBase\view().

Here is the call graph for this function:

static getVisibleChildren ( array  $elements)
static

Returns the visible children of an element.

Parameters
array$elementsThe parent element.
Returns
array The array keys of the element's visible children.

Referenced by SetCustomize\actions(), LocalTasksBlock\build(), Details\preRenderDetails(), VerticalTabs\preRenderVerticalTabs(), and ElementTest\testVisibleChildren().

Here is the caller graph for this function:

static isEmpty ( array  $elements)
static

Indicates whether the given element is empty.

An element that only has cache set is considered empty, because it will render to the empty string.

Parameters
array$elementsThe element.
Returns
bool Whether the given element is empty.

Referenced by BlockViewBuilder\preRender(), and ElementTest\testIsEmpty().

Here is the caller graph for this function:

static isVisibleElement (   $element)
static

Determines if an element is visible.

Parameters
array$elementThe element to check for visibility.
Returns
bool TRUE if the element is visible, otherwise FALSE.

References AccessResultInterface\isAllowed().

Referenced by FormErrorHandler\displayErrorMessages().

Here is the call graph for this function:

Here is the caller graph for this function:

static properties ( array  $element)
static

Gets properties of a structured array element (keys beginning with '#').

Parameters
array$elementAn element array to return properties for.
Returns
array An array of property keys for the element.

Referenced by RenderCache\getCacheableRenderArray(), TextFormat\processFormat(), ElementTest\testProperties(), and RendererTest\testRenderCacheProperties().

Here is the caller graph for this function:

static property (   $key)
static

Checks if the key is a property.

Parameters
string$keyThe key to check.
Returns
bool TRUE of the key is a property, FALSE otherwise.

Referenced by ElementTest\testProperty().

Here is the caller graph for this function:

static setAttributes ( array &  $element,
array  $map 
)
static

Sets HTML attributes based on element properties.

Parameters
array$elementThe renderable element to process. Passed by reference.
array$mapAn associative array whose keys are element property names and whose values are the HTML attribute names to set on the corresponding property; e.g., array('#propertyname' => 'attributename'). If both names are identical except for the leading '#', then an attribute name value is sufficient and no property name needs to be specified.

Referenced by ImageButton\preRenderButton(), Button\preRenderButton(), Checkbox\preRenderCheckbox(), Color\preRenderColor(), Date\preRenderDate(), Details\preRenderDetails(), File\preRenderFile(), Hidden\preRenderHidden(), Number\preRenderNumber(), Password\preRenderPassword(), Radio\preRenderRadio(), Range\preRenderRange(), Search\preRenderSearch(), Select\preRenderSelect(), Table\preRenderTable(), Tel\preRenderTel(), Textfield\preRenderTextfield(), Url\preRenderUrl(), and ElementTest\testSetAttributes().

Here is the caller graph for this function:


The documentation for this class was generated from the following file: