code
stringlengths
17
296k
docstring
stringlengths
30
30.3k
func_name
stringlengths
1
89
language
stringclasses
1 value
repo
stringlengths
7
63
path
stringlengths
7
153
url
stringlengths
51
209
license
stringclasses
4 values
public function isSaveable() { return !$this->showOnClick || ($this->showOnClick && $this->hiddenField && $this->hiddenField->Value()); }
Determines if the field was actually shown on the client side - if not, we don't validate or save it. @return boolean
isSaveable
php
silverstripe/silverstripe-framework
src/Forms/ConfirmedPasswordField.php
https://github.com/silverstripe/silverstripe-framework/blob/master/src/Forms/ConfirmedPasswordField.php
BSD-3-Clause
public function saveInto(DataObjectInterface $record) { if (!$this->isSaveable()) { return; } // Create a random password if password is blank and the flag is set if (!$this->value && $this->canBeEmpty && $this->randomPasswordCallback ) { if (!is_callable($this->randomPasswordCallback)) { throw new LogicException('randomPasswordCallback must be callable'); } $this->value = call_user_func_array($this->randomPasswordCallback, [$this->maxLength ?: 0]); } if ($this->value || $this->canBeEmtpy) { parent::saveInto($record); } }
Only save if field was shown on the client, and is not empty or random password generation is enabled
saveInto
php
silverstripe/silverstripe-framework
src/Forms/ConfirmedPasswordField.php
https://github.com/silverstripe/silverstripe-framework/blob/master/src/Forms/ConfirmedPasswordField.php
BSD-3-Clause
public function performReadonlyTransformation() { $field = $this->castedCopy(ReadonlyField::class) ->setTitle($this->title ? $this->title : _t('SilverStripe\\Security\\Member.PASSWORD', 'Password')) ->setValue('*****'); return $field; }
Makes a read only field with some stars in it to replace the password @return ReadonlyField
performReadonlyTransformation
php
silverstripe/silverstripe-framework
src/Forms/ConfirmedPasswordField.php
https://github.com/silverstripe/silverstripe-framework/blob/master/src/Forms/ConfirmedPasswordField.php
BSD-3-Clause
public function getRequireExistingPassword() { return $this->requireExistingPassword; }
Check if existing password is required @return bool
getRequireExistingPassword
php
silverstripe/silverstripe-framework
src/Forms/ConfirmedPasswordField.php
https://github.com/silverstripe/silverstripe-framework/blob/master/src/Forms/ConfirmedPasswordField.php
BSD-3-Clause
public function setRequireExistingPassword($show) { // Don't modify if already added / removed if ((bool)$show === $this->requireExistingPassword) { return $this; } $this->requireExistingPassword = $show; $name = $this->getName(); $currentName = "{$name}[_CurrentPassword]"; if ($show) { $confirmField = PasswordField::create($currentName, _t('SilverStripe\\Security\\Member.CURRENT_PASSWORD', 'Current Password')); $this->getChildren()->unshift($confirmField); } else { $this->getChildren()->removeByName($currentName, true); } return $this; }
Set if the existing password should be required @param bool $show Flag to show or hide this field @return $this
setRequireExistingPassword
php
silverstripe/silverstripe-framework
src/Forms/ConfirmedPasswordField.php
https://github.com/silverstripe/silverstripe-framework/blob/master/src/Forms/ConfirmedPasswordField.php
BSD-3-Clause
public function setMinLength($minLength) { $this->minLength = (int) $minLength; return $this; }
Set the minimum length required for passwords @param int $minLength @return $this
setMinLength
php
silverstripe/silverstripe-framework
src/Forms/ConfirmedPasswordField.php
https://github.com/silverstripe/silverstripe-framework/blob/master/src/Forms/ConfirmedPasswordField.php
BSD-3-Clause
public function setMaxLength($maxLength) { $this->maxLength = (int) $maxLength; return $this; }
Set the maximum length required for passwords @param int $maxLength @return $this
setMaxLength
php
silverstripe/silverstripe-framework
src/Forms/ConfirmedPasswordField.php
https://github.com/silverstripe/silverstripe-framework/blob/master/src/Forms/ConfirmedPasswordField.php
BSD-3-Clause
public static function get($identifier = null) { if (!$identifier) { return static::get_active(); } // Create new instance if unconfigured if (!isset(HTMLEditorConfig::$configs[$identifier])) { HTMLEditorConfig::$configs[$identifier] = static::create(); HTMLEditorConfig::$configs[$identifier]->setOption('editorIdentifier', $identifier); } return HTMLEditorConfig::$configs[$identifier]; }
Get the HTMLEditorConfig object for the given identifier. This is a correct way to get an HTMLEditorConfig instance - do not call 'new' @param string $identifier The identifier for the config set. If omitted, the active config is returned. @return static The configuration object. This will be created if it does not yet exist for that identifier
get
php
silverstripe/silverstripe-framework
src/Forms/HTMLEditor/HTMLEditorConfig.php
https://github.com/silverstripe/silverstripe-framework/blob/master/src/Forms/HTMLEditor/HTMLEditorConfig.php
BSD-3-Clause
public static function set_config($identifier, HTMLEditorConfig $config = null) { if ($config) { HTMLEditorConfig::$configs[$identifier] = $config; HTMLEditorConfig::$configs[$identifier]->setOption('editorIdentifier', $identifier); } else { unset(HTMLEditorConfig::$configs[$identifier]); } return $config; }
Assign a new config, or clear existing, for the given identifier @param string $identifier A specific identifier @param HTMLEditorConfig $config Config to set, or null to clear @return HTMLEditorConfig The assigned config
set_config
php
silverstripe/silverstripe-framework
src/Forms/HTMLEditor/HTMLEditorConfig.php
https://github.com/silverstripe/silverstripe-framework/blob/master/src/Forms/HTMLEditor/HTMLEditorConfig.php
BSD-3-Clause
public static function getThemes() { if (isset(static::$current_themes)) { return static::$current_themes; } return Config::inst()->get(static::class, 'user_themes'); }
Gets the current themes, if it is not set this will fallback to config @return array
getThemes
php
silverstripe/silverstripe-framework
src/Forms/HTMLEditor/HTMLEditorConfig.php
https://github.com/silverstripe/silverstripe-framework/blob/master/src/Forms/HTMLEditor/HTMLEditorConfig.php
BSD-3-Clause
public static function set_active_identifier($identifier) { HTMLEditorConfig::$current = $identifier; }
Set the currently active configuration object. Note that the existing active config will not be renamed to the new identifier. @param string $identifier The identifier for the config set
set_active_identifier
php
silverstripe/silverstripe-framework
src/Forms/HTMLEditor/HTMLEditorConfig.php
https://github.com/silverstripe/silverstripe-framework/blob/master/src/Forms/HTMLEditor/HTMLEditorConfig.php
BSD-3-Clause
public static function get_active_identifier() { $identifier = HTMLEditorConfig::$current ?: static::config()->get('default_config'); return $identifier; }
Get the currently active configuration identifier. Will fall back to default_config if unassigned. @return string The active configuration identifier
get_active_identifier
php
silverstripe/silverstripe-framework
src/Forms/HTMLEditor/HTMLEditorConfig.php
https://github.com/silverstripe/silverstripe-framework/blob/master/src/Forms/HTMLEditor/HTMLEditorConfig.php
BSD-3-Clause
public static function get_active() { $identifier = HTMLEditorConfig::get_active_identifier(); return HTMLEditorConfig::get($identifier); }
Get the currently active configuration object @return HTMLEditorConfig The active configuration object
get_active
php
silverstripe/silverstripe-framework
src/Forms/HTMLEditor/HTMLEditorConfig.php
https://github.com/silverstripe/silverstripe-framework/blob/master/src/Forms/HTMLEditor/HTMLEditorConfig.php
BSD-3-Clause
public static function set_active(HTMLEditorConfig $config) { $identifier = static::get_active_identifier(); return static::set_config($identifier, $config); }
Assigns the currently active config an explicit instance @param HTMLEditorConfig $config @return HTMLEditorConfig The given config
set_active
php
silverstripe/silverstripe-framework
src/Forms/HTMLEditor/HTMLEditorConfig.php
https://github.com/silverstripe/silverstripe-framework/blob/master/src/Forms/HTMLEditor/HTMLEditorConfig.php
BSD-3-Clause
public function getConfigSchemaData() { return [ 'attributes' => $this->getAttributes(), 'editorjs' => null, ]; }
Provide additional schema data for the field this object configures @return array
getConfigSchemaData
php
silverstripe/silverstripe-framework
src/Forms/HTMLEditor/HTMLEditorConfig.php
https://github.com/silverstripe/silverstripe-framework/blob/master/src/Forms/HTMLEditor/HTMLEditorConfig.php
BSD-3-Clause
public function __construct(HTMLEditorConfig $config) { $valid = $config->getOption('valid_elements'); if ($valid) { $this->addValidElements($valid); } $valid = $config->getOption('extended_valid_elements'); if ($valid) { $this->addValidElements($valid); } }
Construct a sanitiser from a given HTMLEditorConfig Note that we build data structures from the current state of HTMLEditorConfig - later changes to the passed instance won't cause this instance to update it's whitelist @param HTMLEditorConfig $config
__construct
php
silverstripe/silverstripe-framework
src/Forms/HTMLEditor/HTMLEditorSanitiser.php
https://github.com/silverstripe/silverstripe-framework/blob/master/src/Forms/HTMLEditor/HTMLEditorSanitiser.php
BSD-3-Clause
protected function patternToRegex($str) { Deprecation::noticeWithNoReplacment( '5.4.0', 'Will be replaced with SilverStripe\Forms\HTMLEditor\HTMLEditorRuleSet::patternToRegex()' ); return '/^' . preg_replace('/([?+*])/', '.$1', $str ?? '') . '$/'; }
Given a TinyMCE pattern (close to unix glob style), create a regex that does the match @param $str - The TinyMCE pattern @return string - The equivalent regex @deprecated 5.4.0 Will be replaced with SilverStripe\Forms\HTMLEditor\HTMLEditorRuleSet::patternToRegex()
patternToRegex
php
silverstripe/silverstripe-framework
src/Forms/HTMLEditor/HTMLEditorSanitiser.php
https://github.com/silverstripe/silverstripe-framework/blob/master/src/Forms/HTMLEditor/HTMLEditorSanitiser.php
BSD-3-Clause
protected function getRuleForElement($tag) { Deprecation::noticeWithNoReplacment( '5.4.0', 'Will be replaced with SilverStripe\Forms\HTMLEditor\HTMLEditorRuleSet::getRuleForElement()' ); if (isset($this->elements[$tag])) { return $this->elements[$tag]; } foreach ($this->elementPatterns as $element) { if (preg_match($element->pattern ?? '', $tag ?? '')) { return $element; } } return null; }
Given an element tag, return the rule structure for that element @param string $tag The element tag @return stdClass The element rule @deprecated 5.4.0 Will be replaced with SilverStripe\Forms\HTMLEditor\HTMLEditorRuleSet::getRuleForElement()
getRuleForElement
php
silverstripe/silverstripe-framework
src/Forms/HTMLEditor/HTMLEditorSanitiser.php
https://github.com/silverstripe/silverstripe-framework/blob/master/src/Forms/HTMLEditor/HTMLEditorSanitiser.php
BSD-3-Clause
protected function getRuleForAttribute($elementRule, $name) { Deprecation::noticeWithNoReplacment( '5.4.0', 'Will be replaced with logic in SilverStripe\Forms\HTMLEditor\HTMLEditorElementRule' ); if (isset($elementRule->attributes[$name])) { return $elementRule->attributes[$name]; } foreach ($elementRule->attributePatterns as $attribute) { if (preg_match($attribute->pattern ?? '', $name ?? '')) { return $attribute; } } return null; }
Given an attribute name, return the rule structure for that attribute @param object $elementRule @param string $name The attribute name @return stdClass The attribute rule @deprecated 5.4.0 Will be replaced with logic in SilverStripe\Forms\HTMLEditor\HTMLEditorElementRule
getRuleForAttribute
php
silverstripe/silverstripe-framework
src/Forms/HTMLEditor/HTMLEditorSanitiser.php
https://github.com/silverstripe/silverstripe-framework/blob/master/src/Forms/HTMLEditor/HTMLEditorSanitiser.php
BSD-3-Clause
protected function elementMatchesRule($element, $rule = null) { Deprecation::noticeWithNoReplacment( '5.4.0', 'Will be replaced with SilverStripe\Forms\HTMLEditor\HTMLEditorRuleSet::isElementAllowed()' ); // If the rule doesn't exist at all, the element isn't allowed if (!$rule) { return false; } // If the rule has attributes required, check them to see if this element has at least one if ($rule->attributesRequired) { $hasMatch = false; foreach ($rule->attributesRequired as $attr) { if ($element->getAttribute($attr)) { $hasMatch = true; break; } } if (!$hasMatch) { return false; } } // If the rule says to remove empty elements, and this element is empty, remove it if ($rule->removeEmpty && !$element->firstChild) { return false; } // No further tests required, element passes return true; }
Given a DOMElement and an element rule, check if that element passes the rule @param DOMElement $element The element to check @param stdClass $rule The rule to check against @return bool True if the element passes (and so can be kept), false if it fails (and so needs stripping) @deprecated 5.4.0 Will be replaced with SilverStripe\Forms\HTMLEditor\HTMLEditorRuleSet::isElementAllowed()
elementMatchesRule
php
silverstripe/silverstripe-framework
src/Forms/HTMLEditor/HTMLEditorSanitiser.php
https://github.com/silverstripe/silverstripe-framework/blob/master/src/Forms/HTMLEditor/HTMLEditorSanitiser.php
BSD-3-Clause
protected function attributeMatchesRule($attr, $rule = null) { Deprecation::noticeWithNoReplacment( '5.4.0', 'Will be replaced with SilverStripe\Forms\HTMLEditor\HTMLEditorElementRule::isAttributeAllowed()' ); // If the rule doesn't exist at all, the attribute isn't allowed if (!$rule) { return false; } // If the rule has a set of valid values, check them to see if this attribute is one if (isset($rule->validValues) && !in_array($attr->value, $rule->validValues ?? [])) { return false; } // No further tests required, attribute passes return true; }
Given a DOMAttr and an attribute rule, check if that attribute passes the rule @param DOMAttr $attr - the attribute to check @param stdClass $rule - the rule to check against @return bool - true if the attribute passes (and so can be kept), false if it fails (and so needs stripping) @deprecated 5.4.0 Will be replaced with SilverStripe\Forms\HTMLEditor\HTMLEditorElementRule::isAttributeAllowed()
attributeMatchesRule
php
silverstripe/silverstripe-framework
src/Forms/HTMLEditor/HTMLEditorSanitiser.php
https://github.com/silverstripe/silverstripe-framework/blob/master/src/Forms/HTMLEditor/HTMLEditorSanitiser.php
BSD-3-Clause
public function getEditorConfig() { // Instance override if ($this->editorConfig instanceof HTMLEditorConfig) { return $this->editorConfig; } // Get named / active config return HTMLEditorConfig::get($this->editorConfig); }
Gets the HTMLEditorConfig instance @return HTMLEditorConfig
getEditorConfig
php
silverstripe/silverstripe-framework
src/Forms/HTMLEditor/HTMLEditorField.php
https://github.com/silverstripe/silverstripe-framework/blob/master/src/Forms/HTMLEditor/HTMLEditorField.php
BSD-3-Clause
public function setEditorConfig($config) { $this->editorConfig = $config; return $this; }
Assign a new configuration instance or identifier @param string|HTMLEditorConfig $config @return $this
setEditorConfig
php
silverstripe/silverstripe-framework
src/Forms/HTMLEditor/HTMLEditorField.php
https://github.com/silverstripe/silverstripe-framework/blob/master/src/Forms/HTMLEditor/HTMLEditorField.php
BSD-3-Clause
public function __construct($name, $title = null, $value = '', $config = null) { parent::__construct($name, $title, $value); if ($config) { $this->setEditorConfig($config); } $this->setRows(HTMLEditorField::config()->default_rows); }
Creates a new HTMLEditorField. @see TextareaField::__construct() @param string $name The internal field name, passed to forms. @param string $title The human-readable field label. @param mixed $value The value of the field. @param string $config HTMLEditorConfig identifier to be used. Default to the active one.
__construct
php
silverstripe/silverstripe-framework
src/Forms/HTMLEditor/HTMLEditorField.php
https://github.com/silverstripe/silverstripe-framework/blob/master/src/Forms/HTMLEditor/HTMLEditorField.php
BSD-3-Clause
public function ValueEntities() { $entities = get_html_translation_table(HTML_ENTITIES); foreach ($entities as $key => $value) { $entities[$key] = "/" . $value . "/"; } $value = preg_replace_callback($entities, function ($matches) { // Don't apply double encoding to ampersand $doubleEncoding = $matches[0] != '&'; return htmlentities($matches[0], ENT_COMPAT, 'UTF-8', $doubleEncoding); }, $this->Value() ?? ''); return $value; }
Return value with all values encoded in html entities @return string Raw HTML
ValueEntities
php
silverstripe/silverstripe-framework
src/Forms/HTMLEditor/HTMLEditorField.php
https://github.com/silverstripe/silverstripe-framework/blob/master/src/Forms/HTMLEditor/HTMLEditorField.php
BSD-3-Clause
public function enablePlugins($plugin) { $plugins = func_get_args(); if (is_array(current($plugins ?? []))) { $plugins = current($plugins ?? []); } foreach ($plugins as $name => $path) { // if plugins are passed without a path if (is_numeric($name)) { $name = $path; $path = null; } if (!array_key_exists($name, $this->plugins ?? [])) { $this->plugins[$name] = $path; } } return $this; }
Enable one or several plugins. Will maintain unique list if already enabled plugin is re-passed. If passed in as a map of plugin-name to path, the plugin will be loaded by tinymce.PluginManager.load() instead of through tinyMCE.init(). Keep in mind that these externals plugins require a dash-prefix in their name. @see https://www.tiny.cloud/docs/tinymce/6/editor-important-options/#external_plugins If passing in a non-associative array, the plugin name should be located in the standard tinymce plugins folder. If passing in an associative array, the key of each item should be the plugin name. The value of each item is one of: - null - Will be treated as a standard plugin in the standard location - relative path - Will be treated as a relative url - absolute url - Some url to an external plugin - An instance of ModuleResource object containing the plugin @param string|array ...$plugin a string, or several strings, or a single array of strings - The plugins to enable @return $this
enablePlugins
php
silverstripe/silverstripe-framework
src/Forms/HTMLEditor/TinyMCEConfig.php
https://github.com/silverstripe/silverstripe-framework/blob/master/src/Forms/HTMLEditor/TinyMCEConfig.php
BSD-3-Clause
public function getPlugins() { return $this->plugins; }
Gets the list of all enabled plugins as an associative array. Array keys are the plugin names, and values are potentially the plugin location, or ModuleResource object @return array
getPlugins
php
silverstripe/silverstripe-framework
src/Forms/HTMLEditor/TinyMCEConfig.php
https://github.com/silverstripe/silverstripe-framework/blob/master/src/Forms/HTMLEditor/TinyMCEConfig.php
BSD-3-Clause
public function getInternalPlugins() { // Return only plugins with no custom url $plugins = []; foreach ($this->getPlugins() as $name => $url) { if (empty($url)) { $plugins[] = $name; } } return $plugins; }
Get list of plugins without custom locations, which is the set of plugins which can be loaded via the standard plugin path, and could potentially be minified @return array
getInternalPlugins
php
silverstripe/silverstripe-framework
src/Forms/HTMLEditor/TinyMCEConfig.php
https://github.com/silverstripe/silverstripe-framework/blob/master/src/Forms/HTMLEditor/TinyMCEConfig.php
BSD-3-Clause
public function getButtons() { return array_filter($this->buttons ?? []); }
Get all button rows, skipping empty rows @return array
getButtons
php
silverstripe/silverstripe-framework
src/Forms/HTMLEditor/TinyMCEConfig.php
https://github.com/silverstripe/silverstripe-framework/blob/master/src/Forms/HTMLEditor/TinyMCEConfig.php
BSD-3-Clause
public function setButtonsForLine($line, $buttons) { if (func_num_args() > 2) { $buttons = func_get_args(); array_shift($buttons); } $this->buttons[$line] = is_array($buttons) ? $buttons : [$buttons]; return $this; }
Totally re-set the buttons on a given line @param int $line The line number to redefine, from 1 to 3 @param string|string[] $buttons,... An array of strings, or one or more strings. The button names to assign to this line. @return $this
setButtonsForLine
php
silverstripe/silverstripe-framework
src/Forms/HTMLEditor/TinyMCEConfig.php
https://github.com/silverstripe/silverstripe-framework/blob/master/src/Forms/HTMLEditor/TinyMCEConfig.php
BSD-3-Clause
public function addButtonsToLine($line, $buttons) { if (func_num_args() > 2) { $buttons = func_get_args(); array_shift($buttons); } if (!is_array($buttons)) { $buttons = [$buttons]; } foreach ($buttons as $button) { $this->buttons[$line][] = $button; } return $this; }
Add buttons to the end of a line @param int $line The line number to redefine, from 1 to 3 @param string ...$buttons A string or several strings, or a single array of strings. The button names to add to this line @return $this
addButtonsToLine
php
silverstripe/silverstripe-framework
src/Forms/HTMLEditor/TinyMCEConfig.php
https://github.com/silverstripe/silverstripe-framework/blob/master/src/Forms/HTMLEditor/TinyMCEConfig.php
BSD-3-Clause
protected function modifyButtons($name, $offset, $del = 0, $add = null) { foreach ($this->buttons as &$buttons) { if (($idx = array_search($name, $buttons ?? [])) !== false) { if ($add) { array_splice($buttons, $idx + $offset, $del, $add); } else { array_splice($buttons, $idx + $offset, $del); } return true; } } return false; }
Internal function for adding and removing buttons related to another button @param string $name The name of the button to modify @param int $offset The offset relative to that button to perform an array_splice at. 0 for before $name, 1 for after. @param int $del The number of buttons to remove at the position given by index(string) + offset @param mixed $add An array or single item to insert at the position given by index(string) + offset, or null for no insertion @return bool True if $name matched a button, false otherwise
modifyButtons
php
silverstripe/silverstripe-framework
src/Forms/HTMLEditor/TinyMCEConfig.php
https://github.com/silverstripe/silverstripe-framework/blob/master/src/Forms/HTMLEditor/TinyMCEConfig.php
BSD-3-Clause
public function insertButtonsBefore($before, $buttons) { if (func_num_args() > 2) { $buttons = func_get_args(); array_shift($buttons); } if (!is_array($buttons)) { $buttons = [$buttons]; } return $this->modifyButtons($before, 0, 0, $buttons); }
Insert buttons before the first occurrence of another button @param string $before the name of the button to insert other buttons before @param string ...$buttons a string, or several strings, or a single array of strings. The button names to insert before that button @return bool True if insertion occurred, false if it did not (because the given button name was not found)
insertButtonsBefore
php
silverstripe/silverstripe-framework
src/Forms/HTMLEditor/TinyMCEConfig.php
https://github.com/silverstripe/silverstripe-framework/blob/master/src/Forms/HTMLEditor/TinyMCEConfig.php
BSD-3-Clause
public function insertButtonsAfter($after, $buttons) { if (func_num_args() > 2) { $buttons = func_get_args(); array_shift($buttons); } if (!is_array($buttons)) { $buttons = [$buttons]; } return $this->modifyButtons($after, 1, 0, $buttons); }
Insert buttons after the first occurrence of another button @param string $after the name of the button to insert other buttons before @param string ...$buttons a string, or several strings, or a single array of strings. The button names to insert after that button @return bool True if insertion occurred, false if it did not (because the given button name was not found)
insertButtonsAfter
php
silverstripe/silverstripe-framework
src/Forms/HTMLEditor/TinyMCEConfig.php
https://github.com/silverstripe/silverstripe-framework/blob/master/src/Forms/HTMLEditor/TinyMCEConfig.php
BSD-3-Clause
public function getContentCSS() { // Prioritise instance specific content if (isset($this->contentCSS)) { return $this->contentCSS; } // Add standard editor.css $editor = []; $editorCSSFiles = $this->config()->get('editor_css'); if ($editorCSSFiles) { foreach ($editorCSSFiles as $editorCSS) { $editor[] = $editorCSS; } } // Themed editor.css $themes = HTMLEditorConfig::getThemes() ?: SSViewer::get_themes(); $themedEditor = ThemeResourceLoader::inst()->findThemedCSS('editor', $themes); if ($themedEditor) { $editor[] = $themedEditor; } return $editor; }
Get list of resource paths to css files. Will default to `editor_css` config, as well as any themed `editor.css` files. Use setContentCSS() to override. @return string[]
getContentCSS
php
silverstripe/silverstripe-framework
src/Forms/HTMLEditor/TinyMCEConfig.php
https://github.com/silverstripe/silverstripe-framework/blob/master/src/Forms/HTMLEditor/TinyMCEConfig.php
BSD-3-Clause
public function setContentCSS($css) { $this->contentCSS = $css; return $this; }
Set explicit set of CSS resources to use for `content_css` option. Note: If merging with default paths, you should call getContentCSS() and merge prior to assignment. @param string[] $css Array of resource paths. Supports module prefix, e.g. `silverstripe/admin:client/dist/styles/editor.css` @return $this
setContentCSS
php
silverstripe/silverstripe-framework
src/Forms/HTMLEditor/TinyMCEConfig.php
https://github.com/silverstripe/silverstripe-framework/blob/master/src/Forms/HTMLEditor/TinyMCEConfig.php
BSD-3-Clause
public function getScriptURL() { $generator = Injector::inst()->get(TinyMCEScriptGenerator::class); return $generator->getScriptURL($this); }
Generate gzipped TinyMCE configuration including plugins and languages. This ends up "pre-loading" TinyMCE bundled with the required plugins so that multiple HTTP requests on the client don't need to be made. @return string @throws Exception
getScriptURL
php
silverstripe/silverstripe-framework
src/Forms/HTMLEditor/TinyMCEConfig.php
https://github.com/silverstripe/silverstripe-framework/blob/master/src/Forms/HTMLEditor/TinyMCEConfig.php
BSD-3-Clause
public static function get_tinymce_lang() { $lang = static::config()->get('tinymce_lang'); $locale = i18n::get_locale(); if (isset($lang[$locale])) { return $lang[$locale]; } return 'en'; }
Get the current tinyMCE language @return string Language
get_tinymce_lang
php
silverstripe/silverstripe-framework
src/Forms/HTMLEditor/TinyMCEConfig.php
https://github.com/silverstripe/silverstripe-framework/blob/master/src/Forms/HTMLEditor/TinyMCEConfig.php
BSD-3-Clause
public function getTinyMCEResourcePath() { $resource = $this->getTinyMCEResource(); if ($resource instanceof ModuleResource) { return $resource->getPath(); } return Director::baseFolder() . '/' . $resource; }
Returns the full filesystem path to TinyMCE resources (which could be different from the original tinymce location in the module). Path will be absolute. @return string @throws Exception
getTinyMCEResourcePath
php
silverstripe/silverstripe-framework
src/Forms/HTMLEditor/TinyMCEConfig.php
https://github.com/silverstripe/silverstripe-framework/blob/master/src/Forms/HTMLEditor/TinyMCEConfig.php
BSD-3-Clause
public function getTinyMCEResourceURL() { $resource = $this->getTinyMCEResource(); if ($resource instanceof ModuleResource) { return $resource->getURL(); } return $resource; }
Get front-end url to tinymce resources @return string @throws Exception
getTinyMCEResourceURL
php
silverstripe/silverstripe-framework
src/Forms/HTMLEditor/TinyMCEConfig.php
https://github.com/silverstripe/silverstripe-framework/blob/master/src/Forms/HTMLEditor/TinyMCEConfig.php
BSD-3-Clause
public function getTinyMCEResource() { $configDir = static::config()->get('base_dir'); if ($configDir) { return ModuleResourceLoader::singleton()->resolveResource($configDir); } throw new Exception(sprintf( 'If the silverstripe/admin module is not installed you must set the TinyMCE path in %s.base_dir', __CLASS__ )); }
Get resource root for TinyMCE, either as a string or ModuleResource instance Path will be relative to BASE_PATH if string. @return ModuleResource|string @throws Exception
getTinyMCEResource
php
silverstripe/silverstripe-framework
src/Forms/HTMLEditor/TinyMCEConfig.php
https://github.com/silverstripe/silverstripe-framework/blob/master/src/Forms/HTMLEditor/TinyMCEConfig.php
BSD-3-Clause
public function setAssetHandler(GeneratedAssetHandler $assetHandler) { $this->assetHandler = $assetHandler; return $this; }
Assign backend store for generated assets @param GeneratedAssetHandler $assetHandler @return $this
setAssetHandler
php
silverstripe/silverstripe-framework
src/Forms/HTMLEditor/TinyMCECombinedGenerator.php
https://github.com/silverstripe/silverstripe-framework/blob/master/src/Forms/HTMLEditor/TinyMCECombinedGenerator.php
BSD-3-Clause
protected function getFileContents($file) { if ($file instanceof ModuleResource) { $path = $file->getPath(); } else { $path = Director::baseFolder() . '/' . $file; } if (!file_exists($path ?? '')) { return null; } $content = file_get_contents($path ?? ''); // Remove UTF-8 BOM if (substr($content ?? '', 0, 3) === pack("CCC", 0xef, 0xbb, 0xbf)) { $content = substr($content ?? '', 3); } return $content; }
Returns the contents of the script file if it exists and removes the UTF-8 BOM header if it exists. @param string|ModuleResource $file File to load. @return string File contents or empty string if it doesn't exist.
getFileContents
php
silverstripe/silverstripe-framework
src/Forms/HTMLEditor/TinyMCECombinedGenerator.php
https://github.com/silverstripe/silverstripe-framework/blob/master/src/Forms/HTMLEditor/TinyMCECombinedGenerator.php
BSD-3-Clause
protected function checkName(TinyMCEConfig $config) { $configs = HTMLEditorConfig::get_available_configs_map(); foreach ($configs as $id => $name) { if (HTMLEditorConfig::get($id) === $config) { return $id; } } return 'custom'; }
Check if this config is registered under a given key @param TinyMCEConfig $config @return string
checkName
php
silverstripe/silverstripe-framework
src/Forms/HTMLEditor/TinyMCECombinedGenerator.php
https://github.com/silverstripe/silverstripe-framework/blob/master/src/Forms/HTMLEditor/TinyMCECombinedGenerator.php
BSD-3-Clause
public function generateFilename(TinyMCEConfig $config) { $hash = substr(sha1(json_encode($config->getAttributes()) ?? ''), 0, 10); $name = $this->checkName($config); $url = str_replace( ['{name}', '{hash}'], [$name, $hash], $this->config()->get('filename_base') ?? '' ); return $url; }
Get filename to use for this config @param TinyMCEConfig $config @return mixed
generateFilename
php
silverstripe/silverstripe-framework
src/Forms/HTMLEditor/TinyMCECombinedGenerator.php
https://github.com/silverstripe/silverstripe-framework/blob/master/src/Forms/HTMLEditor/TinyMCECombinedGenerator.php
BSD-3-Clause
public static function flush() { $dir = dirname(static::config()->get('filename_base') ?? ''); static::singleton()->getAssetHandler()->removeContent($dir); }
This function is triggered early in the request if the "flush" query parameter has been set. Each class that implements Flushable implements this function which looks after it's own specific flushing functionality. @see FlushMiddleware
flush
php
silverstripe/silverstripe-framework
src/Forms/HTMLEditor/TinyMCECombinedGenerator.php
https://github.com/silverstripe/silverstripe-framework/blob/master/src/Forms/HTMLEditor/TinyMCECombinedGenerator.php
BSD-3-Clause
protected function resolveRelativeResource($base, $resource) { // Return resource path based on relative resource path foreach (['', '.min.js', '.js'] as $ext) { // Map resource if ($base instanceof ModuleResource) { $next = $base->getRelativeResource($resource . $ext); } else { $next = rtrim($base ?? '', '/') . '/' . $resource . $ext; } // Ensure resource exists if ($this->resourceExists($next)) { return $next; } } return null; }
Get relative resource for a given base and string @param ModuleResource|string $base @param string $resource @return ModuleResource|string
resolveRelativeResource
php
silverstripe/silverstripe-framework
src/Forms/HTMLEditor/TinyMCECombinedGenerator.php
https://github.com/silverstripe/silverstripe-framework/blob/master/src/Forms/HTMLEditor/TinyMCECombinedGenerator.php
BSD-3-Clause
protected function resourceExists($resource) { if (!$resource) { return false; } if ($resource instanceof ModuleResource) { return $resource->exists(); } $base = rtrim(Director::baseFolder() ?? '', '/'); return file_exists($base . '/' . $resource); }
Check if the given resource exists @param string|ModuleResource $resource @return bool
resourceExists
php
silverstripe/silverstripe-framework
src/Forms/HTMLEditor/TinyMCECombinedGenerator.php
https://github.com/silverstripe/silverstripe-framework/blob/master/src/Forms/HTMLEditor/TinyMCECombinedGenerator.php
BSD-3-Clause
public function setThrowExceptionOnBadDataType($throwExceptionOnBadDataType) { Deprecation::notice('5.2.0', 'Will be removed without equivalent functionality'); $this->throwExceptionOnBadDataType = $throwExceptionOnBadDataType; return $this; }
Determine what happens when this component is used with a list that isn't {@link SS_Filterable}. - true: An exception is thrown - false: This component will be ignored - it won't make any changes to the GridField. By default, this is set to true so that it's clearer what's happening, but the predefined {@link GridFieldConfig} subclasses set this to false for flexibility. @param bool $throwExceptionOnBadDataType @return $this @deprecated 5.2.0 Will be removed without equivalent functionality
setThrowExceptionOnBadDataType
php
silverstripe/silverstripe-framework
src/Forms/GridField/GridFieldSortableHeader.php
https://github.com/silverstripe/silverstripe-framework/blob/master/src/Forms/GridField/GridFieldSortableHeader.php
BSD-3-Clause
protected function checkDataType($dataList) { if ($dataList instanceof Sortable) { return true; } else { // This will be changed to always throw an exception in a future major release. if ($this->throwExceptionOnBadDataType) { throw new LogicException( static::class . " expects an SS_Sortable list to be passed to the GridField." ); } return false; } }
Check that this dataList is of the right data type. Returns false if it's a bad data type, and if appropriate, throws an exception. @param SS_List $dataList @return bool
checkDataType
php
silverstripe/silverstripe-framework
src/Forms/GridField/GridFieldSortableHeader.php
https://github.com/silverstripe/silverstripe-framework/blob/master/src/Forms/GridField/GridFieldSortableHeader.php
BSD-3-Clause
public function setFieldSorting($sorting) { $this->fieldSorting = $sorting; return $this; }
Specify sorting with fieldname as the key, and actual fieldname to sort as value. Example: array("MyCustomTitle"=>"Title", "MyCustomBooleanField" => "ActualBooleanField") @param array $sorting @return $this
setFieldSorting
php
silverstripe/silverstripe-framework
src/Forms/GridField/GridFieldSortableHeader.php
https://github.com/silverstripe/silverstripe-framework/blob/master/src/Forms/GridField/GridFieldSortableHeader.php
BSD-3-Clause
public function getManipulatedData(GridField $gridField, SS_List $dataList) { if (!$this->checkDataType($dataList)) { return $dataList; } $state = $this->getState($gridField); if ($state->SortColumn == "") { return $dataList; } // Prevent SQL Injection by validating that SortColumn exists $columns = $gridField->getConfig()->getComponentByType(GridFieldDataColumns::class); $fields = $columns->getDisplayFields($gridField); if (!array_key_exists($state->SortColumn, $fields) && !in_array($state->SortColumn, $this->getFieldSorting()) ) { throw new LogicException('Invalid SortColumn: ' . $state->SortColumn); } return $dataList->sort($state->SortColumn, $state->SortDirection('asc')); }
Returns the manipulated (sorted) DataList. Field names will simply add an 'ORDER BY' clause, relation names will add appropriate joins to the {@link DataQuery} first. @param GridField $gridField @param SS_List&Sortable $dataList @return SS_List
getManipulatedData
php
silverstripe/silverstripe-framework
src/Forms/GridField/GridFieldSortableHeader.php
https://github.com/silverstripe/silverstripe-framework/blob/master/src/Forms/GridField/GridFieldSortableHeader.php
BSD-3-Clause
public function getManipulatedData(GridField $gridField, SS_List $dataList) { // If we are lazy loading an empty the list if ($this->isLazy($gridField)) { if ($dataList instanceof Filterable) { // If our original list can be filtered, filter out all results. $dataList = $dataList->byIDs([-1]); } else { // If not, create an empty list instead. $dataList = ArrayList::create([]); } } return $dataList; }
Empty $datalist if the current request should be lazy loadable. @param GridField $gridField @param SS_List $dataList @return SS_List
getManipulatedData
php
silverstripe/silverstripe-framework
src/Forms/GridField/GridFieldLazyLoader.php
https://github.com/silverstripe/silverstripe-framework/blob/master/src/Forms/GridField/GridFieldLazyLoader.php
BSD-3-Clause
public function getHTMLFragments($gridField) { $gridField->addExtraClass($this->isLazy($gridField) ? 'grid-field--lazy-loadable' : 'grid-field--lazy-loaded'); return []; }
Apply an appropriate CSS class to `$gridField` based on whatever the current request is lazy loadable or not. @param GridField $gridField @return array
getHTMLFragments
php
silverstripe/silverstripe-framework
src/Forms/GridField/GridFieldLazyLoader.php
https://github.com/silverstripe/silverstripe-framework/blob/master/src/Forms/GridField/GridFieldLazyLoader.php
BSD-3-Clause
private function isLazy(GridField $gridField) { return $gridField->getRequest()->getHeader('X-Pjax') !== 'CurrentField' && $this->isInTabSet($gridField); }
Detect if the current request should include results. @param GridField $gridField @return bool
isLazy
php
silverstripe/silverstripe-framework
src/Forms/GridField/GridFieldLazyLoader.php
https://github.com/silverstripe/silverstripe-framework/blob/master/src/Forms/GridField/GridFieldLazyLoader.php
BSD-3-Clause
private function isInTabSet(FormField $field) { $list = $field->getContainerFieldList(); if ($list && $containerField = $list->getContainerField()) { // Classes that extends TabSet might not have the expected JS to lazy load. return get_class($containerField) === TabSet::class ?: $this->isInTabSet($containerField); } return false; }
Recursively check if $field is inside a TabSet. @param FormField $field @return bool
isInTabSet
php
silverstripe/silverstripe-framework
src/Forms/GridField/GridFieldLazyLoader.php
https://github.com/silverstripe/silverstripe-framework/blob/master/src/Forms/GridField/GridFieldLazyLoader.php
BSD-3-Clause
public function getHTMLFragments($gridField) { $button = new GridField_FormAction( $gridField, 'print', _t('SilverStripe\\Forms\\GridField\\GridField.Print', 'Print'), 'print', null ); $button->setForm($gridField->getForm()); $button->addExtraClass('font-icon-print grid-print-button btn btn-secondary'); return [ $this->targetFragment => $button->Field(), ]; }
Place the print button in a <p> tag below the field @param GridField $gridField @return array
getHTMLFragments
php
silverstripe/silverstripe-framework
src/Forms/GridField/GridFieldPrintButton.php
https://github.com/silverstripe/silverstripe-framework/blob/master/src/Forms/GridField/GridFieldPrintButton.php
BSD-3-Clause
public function getURLHandlers($gridField) { return [ 'print' => 'handlePrint', ]; }
Print is accessible via the url @param GridField $gridField @return array
getURLHandlers
php
silverstripe/silverstripe-framework
src/Forms/GridField/GridFieldPrintButton.php
https://github.com/silverstripe/silverstripe-framework/blob/master/src/Forms/GridField/GridFieldPrintButton.php
BSD-3-Clause
public function handlePrint($gridField, $request = null) { set_time_limit(60); Requirements::clear(); $data = $this->generatePrintData($gridField); $this->extend('updatePrintData', $data); if ($data) { return $data->renderWith([ get_class($gridField) . '_print', GridField::class . '_print', ]); } return null; }
Handle the print, for both the action button and the URL @param GridField $gridField @param HTTPRequest $request @return DBHTMLText
handlePrint
php
silverstripe/silverstripe-framework
src/Forms/GridField/GridFieldPrintButton.php
https://github.com/silverstripe/silverstripe-framework/blob/master/src/Forms/GridField/GridFieldPrintButton.php
BSD-3-Clause
public function handleAction(GridField $gridField, $actionName, $arguments, $data) { switch ($actionName) { case 'addto': if (isset($data['relationID']) && $data['relationID']) { $gridField->State->GridFieldAddRelation = $data['relationID']; } break; } }
Manipulate the state to add a new relation @param GridField $gridField @param string $actionName Action identifier, see {@link getActions()}. @param array $arguments Arguments relevant for this @param array $data All form data
handleAction
php
silverstripe/silverstripe-framework
src/Forms/GridField/GridFieldAddExistingAutocompleter.php
https://github.com/silverstripe/silverstripe-framework/blob/master/src/Forms/GridField/GridFieldAddExistingAutocompleter.php
BSD-3-Clause
public function getManipulatedData(GridField $gridField, SS_List $dataList) { $dataClass = $gridField->getModelClass(); if (!is_a($dataClass, DataObject::class, true)) { throw new LogicException(__CLASS__ . " must be used with DataObject subclasses. Found '$dataClass'"); } $objectID = $gridField->State->GridFieldAddRelation(null); if (empty($objectID)) { return $dataList; } $gridField->State->GridFieldAddRelation = null; $object = DataObject::get_by_id($dataClass, $objectID); if ($object) { if (!$object->canView()) { throw new HTTPResponse_Exception(null, 403); } $dataList->add($object); } return $dataList; }
If an object ID is set, add the object to the list @param GridField $gridField @param SS_List $dataList @return SS_List
getManipulatedData
php
silverstripe/silverstripe-framework
src/Forms/GridField/GridFieldAddExistingAutocompleter.php
https://github.com/silverstripe/silverstripe-framework/blob/master/src/Forms/GridField/GridFieldAddExistingAutocompleter.php
BSD-3-Clause
public function setSearchList(SS_List $list) { $this->searchList = $list; return $this; }
Sets the base list instance which will be used for the autocomplete search. @param SS_List $list
setSearchList
php
silverstripe/silverstripe-framework
src/Forms/GridField/GridFieldAddExistingAutocompleter.php
https://github.com/silverstripe/silverstripe-framework/blob/master/src/Forms/GridField/GridFieldAddExistingAutocompleter.php
BSD-3-Clause
public function scaffoldSearchFields($dataClass) { if (!is_a($dataClass, DataObject::class, true)) { throw new LogicException(__CLASS__ . " must be used with DataObject subclasses. Found '$dataClass'"); } $obj = DataObject::singleton($dataClass); $fields = null; if ($fieldSpecs = $obj->searchableFields()) { $customSearchableFields = $obj->config()->get('searchable_fields'); foreach ($fieldSpecs as $name => $spec) { if (is_array($spec) && array_key_exists('filter', $spec ?? [])) { // The searchableFields() spec defaults to PartialMatch, // so we need to check the original setting. // If the field is defined $searchable_fields = array('MyField'), // then default to StartsWith filter, which makes more sense in this context. if (!$customSearchableFields || array_search($name, $customSearchableFields ?? []) !== false) { $filter = 'StartsWith'; } else { $filterName = $spec['filter']; // It can be an instance if ($filterName instanceof SearchFilter) { $filterName = get_class($filterName); } // It can be a fully qualified class name if (strpos($filterName ?? '', '\\') !== false) { $filterNameParts = explode("\\", $filterName ?? ''); // We expect an alias matching the class name without namespace, see #coresearchaliases $filterName = array_pop($filterNameParts); } $filter = preg_replace('/Filter$/', '', $filterName ?? ''); } $fields[] = "{$name}:{$filter}"; } else { $fields[] = $name; } } } if (is_null($fields)) { if ($obj->hasDatabaseField('Title')) { $fields = ['Title']; } elseif ($obj->hasDatabaseField('Name')) { $fields = ['Name']; } } return $fields; }
Detect searchable fields and searchable relations. Falls back to {@link DataObject->summaryFields()} if no custom search fields are defined. @param string $dataClass The class name @return array|null names of the searchable fields
scaffoldSearchFields
php
silverstripe/silverstripe-framework
src/Forms/GridField/GridFieldAddExistingAutocompleter.php
https://github.com/silverstripe/silverstripe-framework/blob/master/src/Forms/GridField/GridFieldAddExistingAutocompleter.php
BSD-3-Clause
public function getResultsLimit() { return $this->resultsLimit; }
Gets the maximum number of autocomplete results to display. @return int
getResultsLimit
php
silverstripe/silverstripe-framework
src/Forms/GridField/GridFieldAddExistingAutocompleter.php
https://github.com/silverstripe/silverstripe-framework/blob/master/src/Forms/GridField/GridFieldAddExistingAutocompleter.php
BSD-3-Clause
public function getComponentsByType($type) { $components = new ArrayList(); foreach ($this->components as $component) { if ($component instanceof $type) { $components->push($component); } } return $components; }
Returns all components extending a certain class, or implementing a certain interface. @template T of GridFieldComponent @param class-string<T> $type Class name or interface @return ArrayList<T>
getComponentsByType
php
silverstripe/silverstripe-framework
src/Forms/GridField/GridFieldConfig.php
https://github.com/silverstripe/silverstripe-framework/blob/master/src/Forms/GridField/GridFieldConfig.php
BSD-3-Clause
public function getComponentByType($type) { foreach ($this->components as $component) { if ($component instanceof $type) { return $component; } } return null; }
Returns the first available component with the given class or interface. @template T of GridFieldComponent @param class-string<T> $type ClassName @return T|null
getComponentByType
php
silverstripe/silverstripe-framework
src/Forms/GridField/GridFieldConfig.php
https://github.com/silverstripe/silverstripe-framework/blob/master/src/Forms/GridField/GridFieldConfig.php
BSD-3-Clause
public function augmentColumns($gridField, &$columns) { $baseColumns = array_keys($this->getDisplayFields($gridField) ?? []); foreach ($baseColumns as $col) { $columns[] = $col; } $columns = array_unique($columns ?? []); }
Modify the list of columns displayed in the table. See {@link GridFieldDataColumns->getDisplayFields()} and {@link GridFieldDataColumns}. @param GridField $gridField @param array $columns List reference of all column names. (by reference)
augmentColumns
php
silverstripe/silverstripe-framework
src/Forms/GridField/GridFieldDataColumns.php
https://github.com/silverstripe/silverstripe-framework/blob/master/src/Forms/GridField/GridFieldDataColumns.php
BSD-3-Clause
public function getColumnsHandled($gridField) { return array_keys($this->getDisplayFields($gridField) ?? []); }
Names of all columns which are affected by this component. @param GridField $gridField @return array
getColumnsHandled
php
silverstripe/silverstripe-framework
src/Forms/GridField/GridFieldDataColumns.php
https://github.com/silverstripe/silverstripe-framework/blob/master/src/Forms/GridField/GridFieldDataColumns.php
BSD-3-Clause
public function setDisplayFields($fields) { if (!is_array($fields)) { throw new InvalidArgumentException( 'Arguments passed to GridFieldDataColumns::setDisplayFields() must be an array' ); } $this->displayFields = $fields; return $this; }
Override the default behaviour of showing the models summaryFields with these fields instead Example: array( 'Name' => 'Members name', 'Email' => 'Email address') @param array $fields @return $this
setDisplayFields
php
silverstripe/silverstripe-framework
src/Forms/GridField/GridFieldDataColumns.php
https://github.com/silverstripe/silverstripe-framework/blob/master/src/Forms/GridField/GridFieldDataColumns.php
BSD-3-Clause
public function setFieldCasting($casting) { $this->fieldCasting = $casting; return $this; }
Specify castings with fieldname as the key, and the desired casting as value. Example: array("MyCustomDate"=>"Date","MyShortText"=>"Text->FirstSentence") @param array $casting @return $this
setFieldCasting
php
silverstripe/silverstripe-framework
src/Forms/GridField/GridFieldDataColumns.php
https://github.com/silverstripe/silverstripe-framework/blob/master/src/Forms/GridField/GridFieldDataColumns.php
BSD-3-Clause
public function setFieldFormatting($formatting) { $this->fieldFormatting = $formatting; return $this; }
Specify custom formatting for fields, e.g. to render a link instead of pure text. Caution: Make sure to escape special php-characters like in a normal php-statement. Example: "myFieldName" => '<a href=\"custom-admin/$ID\">$ID</a>'. Alternatively, pass a anonymous function, which takes two parameters: The value and the original list item. Formatting is applied after field casting, so if you're modifying the string to include further data through custom formatting, ensure it's correctly escaped. @param array $formatting @return $this
setFieldFormatting
php
silverstripe/silverstripe-framework
src/Forms/GridField/GridFieldDataColumns.php
https://github.com/silverstripe/silverstripe-framework/blob/master/src/Forms/GridField/GridFieldDataColumns.php
BSD-3-Clause
public function getColumnContent($gridField, $record, $columnName) { // Find the data column for the given named column $columns = $this->getDisplayFields($gridField); $columnInfo = array_key_exists($columnName, $columns ?? []) ? $columns[$columnName] : null; // Allow callbacks if (is_array($columnInfo) && isset($columnInfo['callback'])) { $method = $columnInfo['callback']; $value = $method($record, $columnName, $gridField); // This supports simple FieldName syntax } else { $value = $gridField->getDataFieldValue($record, $columnName); } // Turn $value, whatever it is, into a HTML embeddable string $value = $this->castValue($gridField, $columnName, $value); // Make any formatting tweaks $value = $this->formatValue($gridField, $record, $columnName, $value); // Do any final escaping $value = $this->escapeValue($gridField, $value); return $value; }
HTML for the column, content of the <td> element. @param GridField $gridField @param ViewableData $record Record displayed in this row @param string $columnName @return string HTML for the column. Return NULL to skip.
getColumnContent
php
silverstripe/silverstripe-framework
src/Forms/GridField/GridFieldDataColumns.php
https://github.com/silverstripe/silverstripe-framework/blob/master/src/Forms/GridField/GridFieldDataColumns.php
BSD-3-Clause
public function getColumnMetadata($gridField, $column) { $columns = $this->getDisplayFields($gridField); $title = null; if (is_string($columns[$column])) { $title = $columns[$column]; } elseif (is_array($columns[$column]) && isset($columns[$column]['title'])) { $title = $columns[$column]['title']; } return [ 'title' => $title, ]; }
Additional metadata about the column which can be used by other components, e.g. to set a title for a search column header. @param GridField $gridField @param string $column @return array Map of arbitrary metadata identifiers to their values.
getColumnMetadata
php
silverstripe/silverstripe-framework
src/Forms/GridField/GridFieldDataColumns.php
https://github.com/silverstripe/silverstripe-framework/blob/master/src/Forms/GridField/GridFieldDataColumns.php
BSD-3-Clause
protected function getValueFromRelation($record, $columnName) { Deprecation::notice('5.4.0', 'Will be removed without equivalent functionality to replace it.'); $fieldNameParts = explode('.', $columnName ?? ''); $tmpItem = clone($record); for ($idx = 0; $idx < sizeof($fieldNameParts ?? []); $idx++) { $methodName = $fieldNameParts[$idx]; // Last mmethod call from $columnName return what that method is returning if ($idx == sizeof($fieldNameParts ?? []) - 1) { return $tmpItem->XML_val($methodName); } // else get the object from this $methodName $tmpItem = $tmpItem->$methodName(); } return null; }
Translate a Object.RelationName.ColumnName $columnName into the value that ColumnName returns @param ViewableData $record @param string $columnName @return string|null - returns null if it could not found a value @deprecated 5.4.0 Will be removed without equivalent functionality to replace it.
getValueFromRelation
php
silverstripe/silverstripe-framework
src/Forms/GridField/GridFieldDataColumns.php
https://github.com/silverstripe/silverstripe-framework/blob/master/src/Forms/GridField/GridFieldDataColumns.php
BSD-3-Clause
public function setModelClass($modelClassName) { $this->modelClassName = $modelClassName; return $this; }
Set the modelClass (data object) that this field will get it column headers from. If no $displayFields has been set, the display fields will be $summary_fields. @see GridFieldDataColumns::getDisplayFields() @param string $modelClassName @return $this
setModelClass
php
silverstripe/silverstripe-framework
src/Forms/GridField/GridField.php
https://github.com/silverstripe/silverstripe-framework/blob/master/src/Forms/GridField/GridField.php
BSD-3-Clause
public function getModelClass() { if ($this->modelClassName) { return $this->modelClassName; } /** @var DataList|ArrayList $list */ $list = $this->list; if ($list && $list->hasMethod('dataClass')) { $class = $list->dataClass(); if ($class) { return $class; } } throw new LogicException( 'GridField doesn\'t have a modelClassName, so it doesn\'t know the columns of this grid.' ); }
Returns the class name of the record type that this GridField should contain. @return string @throws LogicException
getModelClass
php
silverstripe/silverstripe-framework
src/Forms/GridField/GridField.php
https://github.com/silverstripe/silverstripe-framework/blob/master/src/Forms/GridField/GridField.php
BSD-3-Clause
public function setReadonlyComponents(array $components) { $this->readonlyComponents = $components; }
Overload the readonly components for this gridfield. @param array $components an array map of component class references to whitelist for a readonly version.
setReadonlyComponents
php
silverstripe/silverstripe-framework
src/Forms/GridField/GridField.php
https://github.com/silverstripe/silverstripe-framework/blob/master/src/Forms/GridField/GridField.php
BSD-3-Clause
public function getReadonlyComponents() { return $this->readonlyComponents; }
Return the readonly components @return array a map of component classes.
getReadonlyComponents
php
silverstripe/silverstripe-framework
src/Forms/GridField/GridField.php
https://github.com/silverstripe/silverstripe-framework/blob/master/src/Forms/GridField/GridField.php
BSD-3-Clause
public function performReadonlyTransformation() { $copy = clone $this; $copy->setReadonly(true); $copyConfig = $copy->getConfig(); $hadEditButton = $copyConfig->getComponentByType(GridFieldEditButton::class) !== null; // get the whitelist for allowable readonly components $allowedComponents = $this->getReadonlyComponents(); foreach ($this->getConfig()->getComponents() as $component) { // if a component doesn't exist, remove it from the readonly version. if (!in_array(get_class($component), $allowedComponents ?? [])) { $copyConfig->removeComponent($component); } } // If the edit button has been removed, replace it with a view button if one is allowed if ($hadEditButton && !$copyConfig->getComponentByType(GridFieldViewButton::class)) { $viewButtonClass = null; foreach ($allowedComponents as $componentClass) { if (is_a($componentClass, GridFieldViewButton::class, true)) { $viewButtonClass = $componentClass; break; } } if ($viewButtonClass) { $copyConfig->addComponent($viewButtonClass::create()); } } $copy->extend('afterPerformReadonlyTransformation', $this); return $copy; }
Custom Readonly transformation to remove actions which shouldn't be present for a readonly state. @return GridField
performReadonlyTransformation
php
silverstripe/silverstripe-framework
src/Forms/GridField/GridField.php
https://github.com/silverstripe/silverstripe-framework/blob/master/src/Forms/GridField/GridField.php
BSD-3-Clause
public function performDisabledTransformation() { parent::performDisabledTransformation(); return $this->performReadonlyTransformation(); }
Disabling the gridfield should have the same affect as making it readonly (removing all action items). @return GridField
performDisabledTransformation
php
silverstripe/silverstripe-framework
src/Forms/GridField/GridField.php
https://github.com/silverstripe/silverstripe-framework/blob/master/src/Forms/GridField/GridField.php
BSD-3-Clause
public function getCastedValue($value, $castingDefinition) { $castingParams = []; if (is_array($castingDefinition)) { $castingParams = $castingDefinition; array_shift($castingParams); $castingDefinition = array_shift($castingDefinition); } if (strpos($castingDefinition ?? '', '->') === false) { $castingFieldType = $castingDefinition; $castingField = DBField::create_field($castingFieldType, $value); return call_user_func_array([$castingField, 'XML'], $castingParams ?? []); } list($castingFieldType, $castingMethod) = explode('->', $castingDefinition ?? ''); $castingField = DBField::create_field($castingFieldType, $value); return call_user_func_array([$castingField, $castingMethod], $castingParams ?? []); }
Cast an arbitrary value with the help of a $castingDefinition. @param mixed $value @param string|array $castingDefinition @return mixed
getCastedValue
php
silverstripe/silverstripe-framework
src/Forms/GridField/GridField.php
https://github.com/silverstripe/silverstripe-framework/blob/master/src/Forms/GridField/GridField.php
BSD-3-Clause
public function getState($getData = true) { // Initialise state on first call. This ensures it's evaluated after components have been added if (!$this->state) { $this->initState(); } if ($getData) { return $this->state->getData(); } return $this->state; }
Get the current GridState_Data or the GridState. @param bool $getData @return GridState_Data|GridState
getState
php
silverstripe/silverstripe-framework
src/Forms/GridField/GridField.php
https://github.com/silverstripe/silverstripe-framework/blob/master/src/Forms/GridField/GridField.php
BSD-3-Clause
public function getColumns() { $columns = []; foreach ($this->getComponents() as $item) { if ($item instanceof GridField_ColumnProvider) { $item->augmentColumns($this, $columns); } } return $columns; }
Get the columns of this GridField, they are provided by attached GridField_ColumnProvider. @return array
getColumns
php
silverstripe/silverstripe-framework
src/Forms/GridField/GridField.php
https://github.com/silverstripe/silverstripe-framework/blob/master/src/Forms/GridField/GridField.php
BSD-3-Clause
public function addDataFields($fields) { if ($this->customDataFields) { $this->customDataFields = array_merge($this->customDataFields, $fields); } else { $this->customDataFields = $fields; } }
Add additional calculated data fields to be used on this GridField @param array $fields a map of fieldname to callback. The callback will be passed the record as an argument.
addDataFields
php
silverstripe/silverstripe-framework
src/Forms/GridField/GridField.php
https://github.com/silverstripe/silverstripe-framework/blob/master/src/Forms/GridField/GridField.php
BSD-3-Clause
public function getDataFieldValue($record, $fieldName) { if (isset($this->customDataFields[$fieldName])) { $callback = $this->customDataFields[$fieldName]; return $callback($record); } if ($record->hasMethod('relField')) { return $record->relField($fieldName); } if ($record->hasMethod($fieldName)) { return $record->$fieldName(); } return $record->$fieldName; }
Get the value of a named field on the given record. Use of this method ensures that any special rules around the data for this gridfield are followed. @param ViewableData $record @param string $fieldName @return mixed
getDataFieldValue
php
silverstripe/silverstripe-framework
src/Forms/GridField/GridField.php
https://github.com/silverstripe/silverstripe-framework/blob/master/src/Forms/GridField/GridField.php
BSD-3-Clause
public function getColumnCount() { if (!$this->columnDispatch) { $this->buildColumnDispatch(); } return count($this->columnDispatch ?? []); }
Return how many columns the grid will have. @return int
getColumnCount
php
silverstripe/silverstripe-framework
src/Forms/GridField/GridField.php
https://github.com/silverstripe/silverstripe-framework/blob/master/src/Forms/GridField/GridField.php
BSD-3-Clause
protected function buildColumnDispatch() { $this->columnDispatch = []; foreach ($this->getComponents() as $item) { if ($item instanceof GridField_ColumnProvider) { $columns = $item->getColumnsHandled($this); foreach ($columns as $column) { $this->columnDispatch[$column][] = $item; } } } }
Build an columnDispatch that maps a GridField_ColumnProvider to a column for reference later.
buildColumnDispatch
php
silverstripe/silverstripe-framework
src/Forms/GridField/GridField.php
https://github.com/silverstripe/silverstripe-framework/blob/master/src/Forms/GridField/GridField.php
BSD-3-Clause
public function gridFieldAlterAction($data, $form, HTTPRequest $request) { $data = $request->requestVars(); // Protection against CSRF attacks $token = $this ->getForm() ->getSecurityToken(); if (!$token->checkRequest($request)) { $this->httpError(400, _t( "SilverStripe\\Forms\\Form.CSRF_FAILED_MESSAGE", "There seems to have been a technical problem. Please click the back button, " . "refresh your browser, and try again." )); } $name = $this->getName(); $fieldData = null; if (isset($data[$name])) { $fieldData = $data[$name]; } $state = $this->getState(false); if (isset($fieldData['GridState'])) { $state->setValue($fieldData['GridState']); } // Fetch the store for the "state" of actions (not the GridField) /** @var StateStore $store */ $store = Injector::inst()->create(StateStore::class . '.' . $this->getName()); foreach ($data as $dataKey => $dataValue) { if (preg_match('/^action_gridFieldAlterAction\?StateID=(.*)/', $dataKey ?? '', $matches)) { $stateChange = $store->load($matches[1]); $actionName = $stateChange['actionName']; $arguments = []; if (isset($stateChange['args'])) { $arguments = $stateChange['args']; }; $html = $this->handleAlterAction($actionName, $arguments, $data); if ($html) { return $html; } } } if ($request->getHeader('X-Pjax') === 'CurrentField') { if ($this->getState()->Readonly === true) { $this->performDisabledTransformation(); } return $this->FieldHolder(); } return $form->forTemplate(); }
This is the action that gets executed when a GridField_AlterAction gets clicked. @param array $data @param Form $form @param HTTPRequest $request @return string
gridFieldAlterAction
php
silverstripe/silverstripe-framework
src/Forms/GridField/GridField.php
https://github.com/silverstripe/silverstripe-framework/blob/master/src/Forms/GridField/GridField.php
BSD-3-Clause
public function handleAlterAction($actionName, $arguments, $data) { $actionName = strtolower($actionName ?? ''); foreach ($this->getComponents() as $component) { if ($component instanceof GridField_ActionProvider) { $actions = array_map('strtolower', (array) $component->getActions($this)); if (in_array($actionName, $actions ?? [])) { return $component->handleAction($this, $actionName, $arguments, $data); } } } throw new InvalidArgumentException(sprintf( 'Can\'t handle action "%s"', $actionName )); }
Pass an action on the first GridField_ActionProvider that matches the $actionName. @param string $actionName @param mixed $arguments @param array $data @return mixed @throws InvalidArgumentException
handleAlterAction
php
silverstripe/silverstripe-framework
src/Forms/GridField/GridField.php
https://github.com/silverstripe/silverstripe-framework/blob/master/src/Forms/GridField/GridField.php
BSD-3-Clause
public function handleRequest(HTTPRequest $request) { if ($this->brokenOnConstruct) { user_error( sprintf( "parent::__construct() needs to be called on %s::__construct()", __CLASS__ ), E_USER_WARNING ); } $this->setRequest($request); $fieldData = $this->getRequest()->requestVar($this->getName()); if ($fieldData && isset($fieldData['GridState'])) { $this->getState(false)->setValue($fieldData['GridState']); } foreach ($this->getComponents() as $component) { if ($component instanceof GridField_URLHandler && $urlHandlers = $component->getURLHandlers($this)) { foreach ($urlHandlers as $rule => $action) { if ($params = $request->match($rule, true)) { // Actions can reference URL parameters. // e.g. '$Action/$ID/$OtherID' → '$Action' if ($action[0] == '$') { $action = $params[substr($action, 1)]; } if (!method_exists($component, 'checkAccessAction') || $component->checkAccessAction($action)) { if (!$action) { $action = "index"; } if (!is_string($action)) { throw new LogicException(sprintf( 'Non-string method name: %s', var_export($action, true) )); } try { $this->extend('beforeCallActionURLHandler', $request, $action); $result = $component->$action($this, $request); $this->extend('afterCallActionURLHandler', $request, $action, $result); } catch (HTTPResponse_Exception $responseException) { $result = $responseException->getResponse(); } if ($result instanceof HTTPResponse && $result->isError()) { return $result; } if ($this !== $result && !$request->isEmptyPattern($rule) && ($result instanceof RequestHandler || $result instanceof HasRequestHandler) ) { if ($result instanceof HasRequestHandler) { $result = $result->getRequestHandler(); } $returnValue = $result->handleRequest($request); if (is_array($returnValue)) { throw new LogicException( 'GridField_URLHandler handlers can\'t return arrays' ); } return $returnValue; } if ($request->allParsed()) { return $result; } return $this->httpError( 404, sprintf( 'I can\'t handle sub-URLs of a %s object.', get_class($result) ) ); } } } } } return parent::handleRequest($request); }
Custom request handler that will check component handlers before proceeding to the default implementation. @param HTTPRequest $request @return array|RequestHandler|HTTPResponse|string @throws HTTPResponse_Exception
handleRequest
php
silverstripe/silverstripe-framework
src/Forms/GridField/GridField.php
https://github.com/silverstripe/silverstripe-framework/blob/master/src/Forms/GridField/GridField.php
BSD-3-Clause
protected function getCreateContext() { $gridField = $this->gridField; $context = []; if ($gridField->getList() instanceof RelationList) { $record = $gridField->getForm()->getRecord(); if ($record && $record instanceof DataObject) { $context['Parent'] = $record; } } return $context; }
Build context for verifying canCreate @see GridFieldAddNewButton::getHTMLFragments() @return array
getCreateContext
php
silverstripe/silverstripe-framework
src/Forms/GridField/GridFieldDetailForm_ItemRequest.php
https://github.com/silverstripe/silverstripe-framework/blob/master/src/Forms/GridField/GridFieldDetailForm_ItemRequest.php
BSD-3-Clause
protected function getFormActions() { $manager = $this->getStateManager(); $actions = FieldList::create(); $majorActions = CompositeField::create()->setName('MajorActions'); $majorActions->setFieldHolderTemplate(get_class($majorActions) . '_holder_buttongroup'); $actions->push($majorActions); if ($this->record->ID !== null && $this->record->ID !== 0) { // existing record if ($this->record->hasMethod('canEdit') && $this->record->canEdit()) { if (!($this->record instanceof DataObjectInterface)) { throw new LogicException(get_class($this->record) . ' must implement ' . DataObjectInterface::class); } $noChangesClasses = 'btn-outline-primary font-icon-tick'; $majorActions->push(FormAction::create('doSave', _t('SilverStripe\\Forms\\GridField\\GridFieldDetailForm.Save', 'Save')) ->addExtraClass($noChangesClasses) ->setAttribute('data-btn-alternate-add', 'btn-primary font-icon-save') ->setAttribute('data-btn-alternate-remove', $noChangesClasses) ->setUseButtonTag(true) ->setAttribute('data-text-alternate', _t('SilverStripe\\CMS\\Controllers\\CMSMain.SAVEDRAFT', 'Save'))); } if ($this->record->hasMethod('canDelete') && $this->record->canDelete()) { if (!($this->record instanceof DataObjectInterface)) { throw new LogicException(get_class($this->record) . ' must implement ' . DataObjectInterface::class); } $actions->insertAfter('MajorActions', FormAction::create('doDelete', _t('SilverStripe\\Forms\\GridField\\GridFieldDetailForm.Delete', 'Delete')) ->setUseButtonTag(true) ->addExtraClass('btn-outline-danger btn-hide-outline font-icon-trash-bin action--delete')); } $gridState = $this->gridField->getState(false); $actions->push(HiddenField::create($manager->getStateKey($this->gridField), null, $gridState)); $actions->push($this->getRightGroupField()); } else { // adding new record //Change the Save label to 'Create' $majorActions->push(FormAction::create('doSave', _t('SilverStripe\\Forms\\GridField\\GridFieldDetailForm.Create', 'Create')) ->setUseButtonTag(true) ->addExtraClass('btn-primary font-icon-plus-thin')); // Add a Cancel link which is a button-like link and link back to one level up. $crumbs = $this->Breadcrumbs(); if ($crumbs && $crumbs->count() >= 2) { $oneLevelUp = $crumbs->offsetGet($crumbs->count() - 2); $text = sprintf( "<a class=\"%s\" href=\"%s\">%s</a>", "crumb btn btn-secondary cms-panel-link", // CSS classes $oneLevelUp->Link, // url _t('SilverStripe\\Forms\\GridField\\GridFieldDetailForm.CancelBtn', 'Cancel') // label ); $actions->insertAfter('MajorActions', LiteralField::create('cancelbutton', $text)); } } $this->extend('updateFormActions', $actions); return $actions; }
Build the set of form field actions for the record being handled @return FieldList
getFormActions
php
silverstripe/silverstripe-framework
src/Forms/GridField/GridFieldDetailForm_ItemRequest.php
https://github.com/silverstripe/silverstripe-framework/blob/master/src/Forms/GridField/GridFieldDetailForm_ItemRequest.php
BSD-3-Clause
protected function getToplevelController() { $c = $this->popupController; while ($c && $c instanceof GridFieldDetailForm_ItemRequest) { $c = $c->getController(); } return $c; }
Traverse the nested RequestHandlers until we reach something that's not GridFieldDetailForm_ItemRequest. This allows us to access the Controller responsible for invoking the top-level GridField. This should be equivalent to getting the controller off the top of the controller stack via Controller::curr(), but allows us to avoid accessing the global state. GridFieldDetailForm_ItemRequests are RequestHandlers, and as such they are not part of the controller stack. @return Controller
getToplevelController
php
silverstripe/silverstripe-framework
src/Forms/GridField/GridFieldDetailForm_ItemRequest.php
https://github.com/silverstripe/silverstripe-framework/blob/master/src/Forms/GridField/GridFieldDetailForm_ItemRequest.php
BSD-3-Clause
public function getEditLink($id) { $link = Controller::join_links( $this->gridField->Link(), 'item', $id ); return $this->gridField->addAllStateToUrl($link); }
Gets the edit link for a record @param int $id The ID of the record in the GridField @return string
getEditLink
php
silverstripe/silverstripe-framework
src/Forms/GridField/GridFieldDetailForm_ItemRequest.php
https://github.com/silverstripe/silverstripe-framework/blob/master/src/Forms/GridField/GridFieldDetailForm_ItemRequest.php
BSD-3-Clause
public function getPreviousRecordID() { return $this->getAdjacentRecordID(-1); }
Gets the ID of the previous record in the list. @return int
getPreviousRecordID
php
silverstripe/silverstripe-framework
src/Forms/GridField/GridFieldDetailForm_ItemRequest.php
https://github.com/silverstripe/silverstripe-framework/blob/master/src/Forms/GridField/GridFieldDetailForm_ItemRequest.php
BSD-3-Clause
public function getNextRecordID() { return $this->getAdjacentRecordID(1); }
Gets the ID of the next record in the list. @return int
getNextRecordID
php
silverstripe/silverstripe-framework
src/Forms/GridField/GridFieldDetailForm_ItemRequest.php
https://github.com/silverstripe/silverstripe-framework/blob/master/src/Forms/GridField/GridFieldDetailForm_ItemRequest.php
BSD-3-Clause
protected function saveFormIntoRecord($data, $form) { $list = $this->gridField->getList(); // Check object matches the correct classname if (isset($data['ClassName']) && $data['ClassName'] != $this->record->ClassName) { $newClassName = $data['ClassName']; // The records originally saved attribute was overwritten by $form->saveInto($record) before. // This is necessary for newClassInstance() to work as expected, and trigger change detection // on the ClassName attribute $this->record->setClassName($this->record->ClassName); // Replace $record with a new instance $this->record = $this->record->newClassInstance($newClassName); } // Save form and any extra saved data into this record. // Set writeComponents = true to write has-one relations / join records $form->saveInto($this->record); // https://github.com/silverstripe/silverstripe-assets/issues/365 $this->record->write(); $this->extend('onAfterSave', $this->record); $extraData = $this->getExtraSavedData($this->record, $list); $list->add($this->record, $extraData); return $this->record; }
Loads the given form data into the underlying record and relation @param array $data @param Form $form @throws ValidationException On error @return ViewableData&DataObjectInterface Saved record
saveFormIntoRecord
php
silverstripe/silverstripe-framework
src/Forms/GridField/GridFieldDetailForm_ItemRequest.php
https://github.com/silverstripe/silverstripe-framework/blob/master/src/Forms/GridField/GridFieldDetailForm_ItemRequest.php
BSD-3-Clause
public function Breadcrumbs($unlinked = false) { if (!$this->popupController->hasMethod('Breadcrumbs')) { return null; } /** @var ArrayList<ArrayData> $items */ $items = $this->popupController->Breadcrumbs($unlinked); if (!$items) { $items = ArrayList::create(); } if ($this->record && $this->record->ID) { $title = ($this->record->Title) ? $this->record->Title : "#{$this->record->ID}"; $items->push(ArrayData::create([ 'Title' => $title, 'Link' => $this->Link() ])); } else { $items->push(ArrayData::create([ 'Title' => _t('SilverStripe\\Forms\\GridField\\GridField.NewRecord', 'New {type}', ['type' => $this->getModelName()]), 'Link' => false ])); } foreach ($items as $item) { if ($item->Link) { $item->Link = $this->gridField->addAllStateToUrl($item->Link); } } $this->extend('updateBreadcrumbs', $items); return $items; }
CMS-specific functionality: Passes through navigation breadcrumbs to the template, and includes the currently edited record (if any). see {@link LeftAndMain->Breadcrumbs()} for details. @param boolean $unlinked @return ArrayList<ArrayData>
Breadcrumbs
php
silverstripe/silverstripe-framework
src/Forms/GridField/GridFieldDetailForm_ItemRequest.php
https://github.com/silverstripe/silverstripe-framework/blob/master/src/Forms/GridField/GridFieldDetailForm_ItemRequest.php
BSD-3-Clause
public function nameEncode($value) { return (string)preg_replace_callback('/[^\w]/', [$this, '_nameEncode'], $value ?? ''); }
Encode all non-word characters. @param string $value @return string
nameEncode
php
silverstripe/silverstripe-framework
src/Forms/GridField/GridField_FormAction.php
https://github.com/silverstripe/silverstripe-framework/blob/master/src/Forms/GridField/GridField_FormAction.php
BSD-3-Clause
protected function getNameFromParent() { $base = $this->gridField; $name = []; do { array_unshift($name, $base->getName()); $base = $base->getForm(); } while ($base && !($base instanceof Form)); return implode('.', $name); }
Calculate the name of the gridfield relative to the form. @return string
getNameFromParent
php
silverstripe/silverstripe-framework
src/Forms/GridField/GridField_FormAction.php
https://github.com/silverstripe/silverstripe-framework/blob/master/src/Forms/GridField/GridField_FormAction.php
BSD-3-Clause