@@ -144,8 +144,10 @@ public function setAllowDeletion(bool $allowDeletion = true): static
144144 }
145145
146146 /**
147- * Is the form allowed to delete the configuration section.
147+ * Whether the form is allowed to delete the configuration section
148+ *
148149 * Note: Creation forms are never allowed to be deleted.
150+ *
149151 * @return bool
150152 */
151153 public function allowDeletion (): bool
@@ -157,13 +159,27 @@ public function allowDeletion(): bool
157159 return $ this ->allowDeletion ;
158160 }
159161
162+ /**
163+ * Set the ability to rename the configuration section
164+ *
165+ * @param bool $allowRename Whether the form is allowed to rename the configuration section
166+ *
167+ * @return $this
168+ */
160169 public function setAllowRename (bool $ allowRename = true ): static
161170 {
162171 $ this ->allowRename = $ allowRename ;
163172
164173 return $ this ;
165174 }
166175
176+ /**
177+ * Whether the form is allowed to rename the configuration section
178+ *
179+ * Note: Creation forms are never allowed to be rename forms.
180+ *
181+ * @return bool
182+ */
167183 public function allowRename (): bool
168184 {
169185 if ($ this ->isCreateForm ()) {
@@ -181,6 +197,8 @@ public function allowRename(): bool
181197 * This is done to allow for deletion of sections that contain invalid configuration.
182198 *
183199 * @return void
200+ *
201+ * @throws ProgrammingError
184202 */
185203 protected function handleDelete (): void
186204 {
@@ -212,6 +230,8 @@ protected function handleDelete(): void
212230 * It renames the underlying section and updates the section name in the form.
213231 *
214232 * @return void
233+ *
234+ * @throws ProgrammingError
215235 */
216236 protected function handleRename (): void
217237 {
@@ -255,9 +275,11 @@ public function hasDeleteButton(): bool
255275 }
256276
257277 /**
258- * Add the section name element to the form. This element is used to create
259- * a new configuration section with the given name. The added element
260- * automatically validates that the name is unique within the configuration.
278+ * Add the section name element to the form
279+ *
280+ * This element is used to create a new configuration section with the given
281+ * name. The added element automatically validates that the name is unique
282+ * within the configuration.
261283 *
262284 * @param array $params Additional parameters to pass to the element constructor
263285 *
@@ -300,13 +322,6 @@ protected function addSectionNameElement(array $params = []): void
300322 $ this ->addElement ('text ' , static ::NAME_ELEMENT_NAME , $ params );
301323 }
302324
303- /**
304- * Get the section and key from the element name.
305- *
306- * @param string $name The element name
307- *
308- * @return string[]|null
309- */
310325 protected function getIniKeyFromName (string $ name ): ?array
311326 {
312327 return [$ this ->section , $ name ];
@@ -340,11 +355,6 @@ protected function onSuccess(): void
340355 }
341356 }
342357
343- /**
344- * Add the store and optionally the delete buttons to the form.
345- *
346- * @return void
347- */
348358 protected function addButtonElements (): void
349359 {
350360 parent ::addButtonElements ();
@@ -367,6 +377,11 @@ protected function addButtonElements(): void
367377 ->prepend ($ deleteButton );
368378 }
369379
380+ /**
381+ * Check if the form should rename the section for this request
382+ *
383+ * @return bool
384+ */
370385 private function shouldRename (): bool
371386 {
372387 if (! $ this ->allowRename () || ! $ this ->hasBeenSubmitted () || ! $ this ->isValid ()) {
0 commit comments