Edit File by line
/home/zeestwma/richards.../wp-conte.../plugins/elemento.../includes/base
File: controls-stack.php
[1500] Fix | Delete
if ( '' !== $instance_value ) {
[1501] Fix | Delete
break;
[1502] Fix | Delete
}
[1503] Fix | Delete
}
[1504] Fix | Delete
}
[1505] Fix | Delete
[1506] Fix | Delete
$parent = isset( $controls[ $parent ]['parent'] ) ? $controls[ $parent ]['parent'] : false;
[1507] Fix | Delete
}
[1508] Fix | Delete
}
[1509] Fix | Delete
[1510] Fix | Delete
/**
[1511] Fix | Delete
* If the $condition_value is a non empty array - check if the $condition_value contains the $instance_value,
[1512] Fix | Delete
* If the $instance_value is a non empty array - check if the $instance_value contains the $condition_value
[1513] Fix | Delete
* otherwise check if they are equal. ( and give the ability to check if the value is an empty array )
[1514] Fix | Delete
*/
[1515] Fix | Delete
if ( is_array( $condition_value ) && ! empty( $condition_value ) ) {
[1516] Fix | Delete
$is_contains = in_array( $instance_value, $condition_value, true );
[1517] Fix | Delete
} elseif ( is_array( $instance_value ) && ! empty( $instance_value ) ) {
[1518] Fix | Delete
$is_contains = in_array( $condition_value, $instance_value, true );
[1519] Fix | Delete
} else {
[1520] Fix | Delete
$is_contains = $instance_value === $condition_value;
[1521] Fix | Delete
}
[1522] Fix | Delete
[1523] Fix | Delete
if (
[1524] Fix | Delete
( $is_negative_condition && $is_contains ) ||
[1525] Fix | Delete
( ! $is_negative_condition && ! $is_contains )
[1526] Fix | Delete
) {
[1527] Fix | Delete
return false;
[1528] Fix | Delete
}
[1529] Fix | Delete
}
[1530] Fix | Delete
[1531] Fix | Delete
return true;
[1532] Fix | Delete
}
[1533] Fix | Delete
[1534] Fix | Delete
/**
[1535] Fix | Delete
* Start controls section.
[1536] Fix | Delete
*
[1537] Fix | Delete
* Used to add a new section of controls. When you use this method, all the
[1538] Fix | Delete
* registered controls from this point will be assigned to this section,
[1539] Fix | Delete
* until you close the section using `end_controls_section()` method.
[1540] Fix | Delete
*
[1541] Fix | Delete
* This method should be used inside `register_controls()`.
[1542] Fix | Delete
*
[1543] Fix | Delete
* @since 1.4.0
[1544] Fix | Delete
* @access public
[1545] Fix | Delete
*
[1546] Fix | Delete
* @param string $section_id Section ID.
[1547] Fix | Delete
* @param array $args Section arguments Optional.
[1548] Fix | Delete
*/
[1549] Fix | Delete
public function start_controls_section( $section_id, array $args = [] ) {
[1550] Fix | Delete
$stack_name = $this->get_name();
[1551] Fix | Delete
[1552] Fix | Delete
/**
[1553] Fix | Delete
* Before section start.
[1554] Fix | Delete
*
[1555] Fix | Delete
* Fires before Elementor section starts in the editor panel.
[1556] Fix | Delete
*
[1557] Fix | Delete
* @since 1.4.0
[1558] Fix | Delete
*
[1559] Fix | Delete
* @param Controls_Stack $this The control.
[1560] Fix | Delete
* @param string $section_id Section ID.
[1561] Fix | Delete
* @param array $args Section arguments.
[1562] Fix | Delete
*/
[1563] Fix | Delete
do_action( 'elementor/element/before_section_start', $this, $section_id, $args );
[1564] Fix | Delete
[1565] Fix | Delete
/**
[1566] Fix | Delete
* Before section start.
[1567] Fix | Delete
*
[1568] Fix | Delete
* Fires before Elementor section starts in the editor panel.
[1569] Fix | Delete
*
[1570] Fix | Delete
* The dynamic portions of the hook name, `$stack_name` and `$section_id`, refers to the stack name and section ID, respectively.
[1571] Fix | Delete
*
[1572] Fix | Delete
* @since 1.4.0
[1573] Fix | Delete
*
[1574] Fix | Delete
* @param Controls_Stack $this The control.
[1575] Fix | Delete
* @param array $args Section arguments.
[1576] Fix | Delete
*/
[1577] Fix | Delete
do_action( "elementor/element/{$stack_name}/{$section_id}/before_section_start", $this, $args );
[1578] Fix | Delete
[1579] Fix | Delete
if ( $this->should_manually_trigger_common_action( $stack_name ) ) {
[1580] Fix | Delete
do_action( "elementor/element/common/{$section_id}/before_section_start", $this, $args );
[1581] Fix | Delete
}
[1582] Fix | Delete
[1583] Fix | Delete
$args['type'] = Controls_Manager::SECTION;
[1584] Fix | Delete
[1585] Fix | Delete
$this->add_control( $section_id, $args );
[1586] Fix | Delete
[1587] Fix | Delete
if ( null !== $this->current_section ) {
[1588] Fix | Delete
wp_die( sprintf( 'Elementor: You can\'t start a section before the end of the previous section "%s".', $this->current_section['section'] ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
[1589] Fix | Delete
}
[1590] Fix | Delete
[1591] Fix | Delete
$this->current_section = $this->get_section_args( $section_id );
[1592] Fix | Delete
[1593] Fix | Delete
if ( $this->injection_point ) {
[1594] Fix | Delete
$this->injection_point['section'] = $this->current_section;
[1595] Fix | Delete
}
[1596] Fix | Delete
[1597] Fix | Delete
/**
[1598] Fix | Delete
* After section start.
[1599] Fix | Delete
*
[1600] Fix | Delete
* Fires after Elementor section starts in the editor panel.
[1601] Fix | Delete
*
[1602] Fix | Delete
* @since 1.4.0
[1603] Fix | Delete
*
[1604] Fix | Delete
* @param Controls_Stack $this The control.
[1605] Fix | Delete
* @param string $section_id Section ID.
[1606] Fix | Delete
* @param array $args Section arguments.
[1607] Fix | Delete
*/
[1608] Fix | Delete
do_action( 'elementor/element/after_section_start', $this, $section_id, $args );
[1609] Fix | Delete
[1610] Fix | Delete
/**
[1611] Fix | Delete
* After section start.
[1612] Fix | Delete
*
[1613] Fix | Delete
* Fires after Elementor section starts in the editor panel.
[1614] Fix | Delete
*
[1615] Fix | Delete
* The dynamic portions of the hook name, `$stack_name` and `$section_id`, refers to the stack name and section ID, respectively.
[1616] Fix | Delete
*
[1617] Fix | Delete
* @since 1.4.0
[1618] Fix | Delete
*
[1619] Fix | Delete
* @param Controls_Stack $this The control.
[1620] Fix | Delete
* @param array $args Section arguments.
[1621] Fix | Delete
*/
[1622] Fix | Delete
do_action( "elementor/element/{$stack_name}/{$section_id}/after_section_start", $this, $args );
[1623] Fix | Delete
[1624] Fix | Delete
if ( $this->should_manually_trigger_common_action( $stack_name ) ) {
[1625] Fix | Delete
do_action( "elementor/element/common/{$section_id}/after_section_start", $this, $args );
[1626] Fix | Delete
}
[1627] Fix | Delete
}
[1628] Fix | Delete
[1629] Fix | Delete
/**
[1630] Fix | Delete
* End controls section.
[1631] Fix | Delete
*
[1632] Fix | Delete
* Used to close an existing open controls section. When you use this method
[1633] Fix | Delete
* it stops adding new controls to this section.
[1634] Fix | Delete
*
[1635] Fix | Delete
* This method should be used inside `register_controls()`.
[1636] Fix | Delete
*
[1637] Fix | Delete
* @since 1.4.0
[1638] Fix | Delete
* @access public
[1639] Fix | Delete
*/
[1640] Fix | Delete
public function end_controls_section() {
[1641] Fix | Delete
$stack_name = $this->get_name();
[1642] Fix | Delete
[1643] Fix | Delete
// Save the current section for the action.
[1644] Fix | Delete
$current_section = $this->current_section;
[1645] Fix | Delete
$section_id = $current_section['section'];
[1646] Fix | Delete
$args = [
[1647] Fix | Delete
'tab' => $current_section['tab'],
[1648] Fix | Delete
];
[1649] Fix | Delete
[1650] Fix | Delete
/**
[1651] Fix | Delete
* Before section end.
[1652] Fix | Delete
*
[1653] Fix | Delete
* Fires before Elementor section ends in the editor panel.
[1654] Fix | Delete
*
[1655] Fix | Delete
* @since 1.4.0
[1656] Fix | Delete
*
[1657] Fix | Delete
* @param Controls_Stack $this The control.
[1658] Fix | Delete
* @param string $section_id Section ID.
[1659] Fix | Delete
* @param array $args Section arguments.
[1660] Fix | Delete
*/
[1661] Fix | Delete
do_action( 'elementor/element/before_section_end', $this, $section_id, $args );
[1662] Fix | Delete
[1663] Fix | Delete
/**
[1664] Fix | Delete
* Before section end.
[1665] Fix | Delete
*
[1666] Fix | Delete
* Fires before Elementor section ends in the editor panel.
[1667] Fix | Delete
*
[1668] Fix | Delete
* The dynamic portions of the hook name, `$stack_name` and `$section_id`, refers to the stack name and section ID, respectively.
[1669] Fix | Delete
*
[1670] Fix | Delete
* @since 1.4.0
[1671] Fix | Delete
*
[1672] Fix | Delete
* @param Controls_Stack $this The control.
[1673] Fix | Delete
* @param array $args Section arguments.
[1674] Fix | Delete
*/
[1675] Fix | Delete
do_action( "elementor/element/{$stack_name}/{$section_id}/before_section_end", $this, $args );
[1676] Fix | Delete
[1677] Fix | Delete
if ( $this->should_manually_trigger_common_action( $stack_name ) ) {
[1678] Fix | Delete
do_action( "elementor/element/common/{$section_id}/before_section_end", $this, $args );
[1679] Fix | Delete
}
[1680] Fix | Delete
[1681] Fix | Delete
$this->current_section = null;
[1682] Fix | Delete
[1683] Fix | Delete
/**
[1684] Fix | Delete
* After section end.
[1685] Fix | Delete
*
[1686] Fix | Delete
* Fires after Elementor section ends in the editor panel.
[1687] Fix | Delete
*
[1688] Fix | Delete
* @since 1.4.0
[1689] Fix | Delete
*
[1690] Fix | Delete
* @param Controls_Stack $this The control.
[1691] Fix | Delete
* @param string $section_id Section ID.
[1692] Fix | Delete
* @param array $args Section arguments.
[1693] Fix | Delete
*/
[1694] Fix | Delete
do_action( 'elementor/element/after_section_end', $this, $section_id, $args );
[1695] Fix | Delete
[1696] Fix | Delete
/**
[1697] Fix | Delete
* After section end.
[1698] Fix | Delete
*
[1699] Fix | Delete
* Fires after Elementor section ends in the editor panel.
[1700] Fix | Delete
*
[1701] Fix | Delete
* The dynamic portions of the hook name, `$stack_name` and `$section_id`, refers to the stack name and section ID, respectively.
[1702] Fix | Delete
*
[1703] Fix | Delete
* @since 1.4.0
[1704] Fix | Delete
*
[1705] Fix | Delete
* @param Controls_Stack $this The control.
[1706] Fix | Delete
* @param array $args Section arguments.
[1707] Fix | Delete
*/
[1708] Fix | Delete
do_action( "elementor/element/{$stack_name}/{$section_id}/after_section_end", $this, $args );
[1709] Fix | Delete
[1710] Fix | Delete
if ( $this->should_manually_trigger_common_action( $stack_name ) ) {
[1711] Fix | Delete
do_action( "elementor/element/common/{$section_id}/after_section_end", $this, $args );
[1712] Fix | Delete
}
[1713] Fix | Delete
}
[1714] Fix | Delete
[1715] Fix | Delete
/**
[1716] Fix | Delete
* Should manually trigger common action.
[1717] Fix | Delete
*
[1718] Fix | Delete
* With the Optimized Markup experiment, the Advanced Tab has been split to maintain backward compatibility:
[1719] Fix | Delete
* - 'common' refers to the existing Advanced Tab.
[1720] Fix | Delete
* - 'common-optimized' refers to the new Advanced Tab for optimized widgets.
[1721] Fix | Delete
*
[1722] Fix | Delete
* Third-party developers may have used hooks like 'elementor/element/common/_section_background/before_section_end'
[1723] Fix | Delete
* to add controls to the Advanced Tab. However, this hook will now only work on widgets that are not optimized.
[1724] Fix | Delete
*
[1725] Fix | Delete
* This method checks whether the 'elementor/element/common/...' hooks should be manually executed
[1726] Fix | Delete
* to prevent third parties from needing to add equivalent hooks for 'elementor/element/common-optimized/...'.
[1727] Fix | Delete
*
[1728] Fix | Delete
* @todo Remove this method and the manual execution of 'common' hooks when the feature is merged.
[1729] Fix | Delete
*
[1730] Fix | Delete
* @access private
[1731] Fix | Delete
*
[1732] Fix | Delete
* @param string $stack_name Stack name.
[1733] Fix | Delete
*
[1734] Fix | Delete
* @return bool
[1735] Fix | Delete
*/
[1736] Fix | Delete
private function should_manually_trigger_common_action( $stack_name ): bool {
[1737] Fix | Delete
return 'common-optimized' === $stack_name && Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' );
[1738] Fix | Delete
}
[1739] Fix | Delete
[1740] Fix | Delete
/**
[1741] Fix | Delete
* Start controls tabs.
[1742] Fix | Delete
*
[1743] Fix | Delete
* Used to add a new set of tabs inside a section. You should use this
[1744] Fix | Delete
* method before adding new individual tabs using `start_controls_tab()`.
[1745] Fix | Delete
* Each tab added after this point will be assigned to this group of tabs,
[1746] Fix | Delete
* until you close it using `end_controls_tabs()` method.
[1747] Fix | Delete
*
[1748] Fix | Delete
* This method should be used inside `register_controls()`.
[1749] Fix | Delete
*
[1750] Fix | Delete
* @since 1.4.0
[1751] Fix | Delete
* @access public
[1752] Fix | Delete
*
[1753] Fix | Delete
* @param string $tabs_id Tabs ID.
[1754] Fix | Delete
* @param array $args Tabs arguments.
[1755] Fix | Delete
*/
[1756] Fix | Delete
public function start_controls_tabs( $tabs_id, array $args = [] ) {
[1757] Fix | Delete
if ( null !== $this->current_tab ) {
[1758] Fix | Delete
wp_die( sprintf( 'Elementor: You can\'t start tabs before the end of the previous tabs "%s".', $this->current_tab['tabs_wrapper'] ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
[1759] Fix | Delete
}
[1760] Fix | Delete
[1761] Fix | Delete
$args['type'] = Controls_Manager::TABS;
[1762] Fix | Delete
[1763] Fix | Delete
$this->add_control( $tabs_id, $args );
[1764] Fix | Delete
[1765] Fix | Delete
$this->current_tab = [
[1766] Fix | Delete
'tabs_wrapper' => $tabs_id,
[1767] Fix | Delete
];
[1768] Fix | Delete
[1769] Fix | Delete
foreach ( [ 'condition', 'conditions' ] as $key ) {
[1770] Fix | Delete
if ( ! empty( $args[ $key ] ) ) {
[1771] Fix | Delete
$this->current_tab[ $key ] = $args[ $key ];
[1772] Fix | Delete
}
[1773] Fix | Delete
}
[1774] Fix | Delete
[1775] Fix | Delete
if ( $this->injection_point ) {
[1776] Fix | Delete
$this->injection_point['tab'] = $this->current_tab;
[1777] Fix | Delete
}
[1778] Fix | Delete
}
[1779] Fix | Delete
[1780] Fix | Delete
/**
[1781] Fix | Delete
* End controls tabs.
[1782] Fix | Delete
*
[1783] Fix | Delete
* Used to close an existing open controls tabs. When you use this method it
[1784] Fix | Delete
* stops adding new controls to this tabs.
[1785] Fix | Delete
*
[1786] Fix | Delete
* This method should be used inside `register_controls()`.
[1787] Fix | Delete
*
[1788] Fix | Delete
* @since 1.4.0
[1789] Fix | Delete
* @access public
[1790] Fix | Delete
*/
[1791] Fix | Delete
public function end_controls_tabs() {
[1792] Fix | Delete
$this->current_tab = null;
[1793] Fix | Delete
}
[1794] Fix | Delete
[1795] Fix | Delete
/**
[1796] Fix | Delete
* Start controls tab.
[1797] Fix | Delete
*
[1798] Fix | Delete
* Used to add a new tab inside a group of tabs. Use this method before
[1799] Fix | Delete
* adding new individual tabs using `start_controls_tab()`.
[1800] Fix | Delete
* Each tab added after this point will be assigned to this group of tabs,
[1801] Fix | Delete
* until you close it using `end_controls_tab()` method.
[1802] Fix | Delete
*
[1803] Fix | Delete
* This method should be used inside `register_controls()`.
[1804] Fix | Delete
*
[1805] Fix | Delete
* @since 1.4.0
[1806] Fix | Delete
* @access public
[1807] Fix | Delete
*
[1808] Fix | Delete
* @param string $tab_id Tab ID.
[1809] Fix | Delete
* @param array $args Tab arguments.
[1810] Fix | Delete
*/
[1811] Fix | Delete
public function start_controls_tab( $tab_id, $args ) {
[1812] Fix | Delete
if ( ! empty( $this->current_tab['inner_tab'] ) ) {
[1813] Fix | Delete
wp_die( sprintf( 'Elementor: You can\'t start a tab before the end of the previous tab "%s".', $this->current_tab['inner_tab'] ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
[1814] Fix | Delete
}
[1815] Fix | Delete
[1816] Fix | Delete
$args['type'] = Controls_Manager::TAB;
[1817] Fix | Delete
$args['tabs_wrapper'] = $this->current_tab['tabs_wrapper'];
[1818] Fix | Delete
[1819] Fix | Delete
$this->add_control( $tab_id, $args );
[1820] Fix | Delete
[1821] Fix | Delete
$this->current_tab['inner_tab'] = $tab_id;
[1822] Fix | Delete
[1823] Fix | Delete
if ( $this->injection_point ) {
[1824] Fix | Delete
$this->injection_point['tab']['inner_tab'] = $this->current_tab['inner_tab'];
[1825] Fix | Delete
}
[1826] Fix | Delete
}
[1827] Fix | Delete
[1828] Fix | Delete
/**
[1829] Fix | Delete
* End controls tab.
[1830] Fix | Delete
*
[1831] Fix | Delete
* Used to close an existing open controls tab. When you use this method it
[1832] Fix | Delete
* stops adding new controls to this tab.
[1833] Fix | Delete
*
[1834] Fix | Delete
* This method should be used inside `register_controls()`.
[1835] Fix | Delete
*
[1836] Fix | Delete
* @since 1.4.0
[1837] Fix | Delete
* @access public
[1838] Fix | Delete
*/
[1839] Fix | Delete
public function end_controls_tab() {
[1840] Fix | Delete
unset( $this->current_tab['inner_tab'] );
[1841] Fix | Delete
}
[1842] Fix | Delete
[1843] Fix | Delete
/**
[1844] Fix | Delete
* Start popover.
[1845] Fix | Delete
*
[1846] Fix | Delete
* Used to add a new set of controls in a popover. When you use this method,
[1847] Fix | Delete
* all the registered controls from this point will be assigned to this
[1848] Fix | Delete
* popover, until you close the popover using `end_popover()` method.
[1849] Fix | Delete
*
[1850] Fix | Delete
* This method should be used inside `register_controls()`.
[1851] Fix | Delete
*
[1852] Fix | Delete
* @since 1.9.0
[1853] Fix | Delete
* @access public
[1854] Fix | Delete
*/
[1855] Fix | Delete
final public function start_popover() {
[1856] Fix | Delete
$this->current_popover = [
[1857] Fix | Delete
'initialized' => false,
[1858] Fix | Delete
];
[1859] Fix | Delete
}
[1860] Fix | Delete
[1861] Fix | Delete
/**
[1862] Fix | Delete
* End popover.
[1863] Fix | Delete
*
[1864] Fix | Delete
* Used to close an existing open popover. When you use this method it stops
[1865] Fix | Delete
* adding new controls to this popover.
[1866] Fix | Delete
*
[1867] Fix | Delete
* This method should be used inside `register_controls()`.
[1868] Fix | Delete
*
[1869] Fix | Delete
* @since 1.9.0
[1870] Fix | Delete
* @access public
[1871] Fix | Delete
*/
[1872] Fix | Delete
final public function end_popover() {
[1873] Fix | Delete
$this->current_popover = null;
[1874] Fix | Delete
[1875] Fix | Delete
$last_control_key = $this->get_control_key( $this->get_pointer_index() - 1 );
[1876] Fix | Delete
[1877] Fix | Delete
$args = [
[1878] Fix | Delete
'popover' => [
[1879] Fix | Delete
'end' => true,
[1880] Fix | Delete
],
[1881] Fix | Delete
];
[1882] Fix | Delete
[1883] Fix | Delete
$options = [
[1884] Fix | Delete
'recursive' => true,
[1885] Fix | Delete
];
[1886] Fix | Delete
[1887] Fix | Delete
$this->update_control( $last_control_key, $args, $options );
[1888] Fix | Delete
}
[1889] Fix | Delete
[1890] Fix | Delete
/**
[1891] Fix | Delete
* Add render attribute.
[1892] Fix | Delete
*
[1893] Fix | Delete
* Used to add attributes to a specific HTML element.
[1894] Fix | Delete
*
[1895] Fix | Delete
* The HTML tag is represented by the element parameter, then you need to
[1896] Fix | Delete
* define the attribute key and the attribute key. The final result will be:
[1897] Fix | Delete
* `<element attribute_key="attribute_value">`.
[1898] Fix | Delete
*
[1899] Fix | Delete
* Example usage:
[1900] Fix | Delete
*
[1901] Fix | Delete
* `$this->add_render_attribute( 'wrapper', 'class', 'custom-widget-wrapper-class' );`
[1902] Fix | Delete
* `$this->add_render_attribute( 'widget', 'id', 'custom-widget-id' );`
[1903] Fix | Delete
* `$this->add_render_attribute( 'button', [ 'class' => 'custom-button-class', 'id' => 'custom-button-id' ] );`
[1904] Fix | Delete
*
[1905] Fix | Delete
* @since 1.0.0
[1906] Fix | Delete
* @access public
[1907] Fix | Delete
*
[1908] Fix | Delete
* @param array|string $element The HTML element.
[1909] Fix | Delete
* @param array|string $key Optional. Attribute key. Default is null.
[1910] Fix | Delete
* @param array|string $value Optional. Attribute value. Default is null.
[1911] Fix | Delete
* @param bool $overwrite Optional. Whether to overwrite existing
[1912] Fix | Delete
* attribute. Default is false, not to overwrite.
[1913] Fix | Delete
*
[1914] Fix | Delete
* @return self Current instance of the element.
[1915] Fix | Delete
*/
[1916] Fix | Delete
public function add_render_attribute( $element, $key = null, $value = null, $overwrite = false ) {
[1917] Fix | Delete
if ( is_array( $element ) ) {
[1918] Fix | Delete
foreach ( $element as $element_key => $attributes ) {
[1919] Fix | Delete
$this->add_render_attribute( $element_key, $attributes, null, $overwrite );
[1920] Fix | Delete
}
[1921] Fix | Delete
[1922] Fix | Delete
return $this;
[1923] Fix | Delete
}
[1924] Fix | Delete
[1925] Fix | Delete
if ( is_array( $key ) ) {
[1926] Fix | Delete
foreach ( $key as $attribute_key => $attributes ) {
[1927] Fix | Delete
$this->add_render_attribute( $element, $attribute_key, $attributes, $overwrite );
[1928] Fix | Delete
}
[1929] Fix | Delete
[1930] Fix | Delete
return $this;
[1931] Fix | Delete
}
[1932] Fix | Delete
[1933] Fix | Delete
if ( empty( $this->render_attributes[ $element ][ $key ] ) ) {
[1934] Fix | Delete
$this->render_attributes[ $element ][ $key ] = [];
[1935] Fix | Delete
}
[1936] Fix | Delete
[1937] Fix | Delete
settype( $value, 'array' );
[1938] Fix | Delete
[1939] Fix | Delete
if ( $overwrite ) {
[1940] Fix | Delete
$this->render_attributes[ $element ][ $key ] = $value;
[1941] Fix | Delete
} else {
[1942] Fix | Delete
$this->render_attributes[ $element ][ $key ] = array_merge( $this->render_attributes[ $element ][ $key ], $value );
[1943] Fix | Delete
}
[1944] Fix | Delete
[1945] Fix | Delete
return $this;
[1946] Fix | Delete
}
[1947] Fix | Delete
[1948] Fix | Delete
/**
[1949] Fix | Delete
* Get Render Attributes
[1950] Fix | Delete
*
[1951] Fix | Delete
* Used to retrieve render attribute.
[1952] Fix | Delete
*
[1953] Fix | Delete
* The returned array is either all elements and their attributes if no `$element` is specified, an array of all
[1954] Fix | Delete
* attributes of a specific element or a specific attribute properties if `$key` is specified.
[1955] Fix | Delete
*
[1956] Fix | Delete
* Returns null if one of the requested parameters isn't set.
[1957] Fix | Delete
*
[1958] Fix | Delete
* @since 2.2.6
[1959] Fix | Delete
* @access public
[1960] Fix | Delete
* @param string $element
[1961] Fix | Delete
* @param string $key
[1962] Fix | Delete
*
[1963] Fix | Delete
* @return array
[1964] Fix | Delete
*/
[1965] Fix | Delete
public function get_render_attributes( $element = '', $key = '' ) {
[1966] Fix | Delete
$attributes = $this->render_attributes;
[1967] Fix | Delete
[1968] Fix | Delete
if ( $element ) {
[1969] Fix | Delete
if ( ! isset( $attributes[ $element ] ) ) {
[1970] Fix | Delete
return null;
[1971] Fix | Delete
}
[1972] Fix | Delete
[1973] Fix | Delete
$attributes = $attributes[ $element ];
[1974] Fix | Delete
[1975] Fix | Delete
if ( $key ) {
[1976] Fix | Delete
if ( ! isset( $attributes[ $key ] ) ) {
[1977] Fix | Delete
return null;
[1978] Fix | Delete
}
[1979] Fix | Delete
[1980] Fix | Delete
$attributes = $attributes[ $key ];
[1981] Fix | Delete
}
[1982] Fix | Delete
}
[1983] Fix | Delete
[1984] Fix | Delete
return $attributes;
[1985] Fix | Delete
}
[1986] Fix | Delete
[1987] Fix | Delete
/**
[1988] Fix | Delete
* Set render attribute.
[1989] Fix | Delete
*
[1990] Fix | Delete
* Used to set the value of the HTML element render attribute or to update
[1991] Fix | Delete
* an existing render attribute.
[1992] Fix | Delete
*
[1993] Fix | Delete
* @since 1.0.0
[1994] Fix | Delete
* @access public
[1995] Fix | Delete
*
[1996] Fix | Delete
* @param array|string $element The HTML element.
[1997] Fix | Delete
* @param array|string $key Optional. Attribute key. Default is null.
[1998] Fix | Delete
* @param array|string $value Optional. Attribute value. Default is null.
[1999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function