Answer the question
In order to leave comments, you need to log in
How to pass the value of the text_format field of the user form with PHP code in drupal 7 for further recording in the database?
It is necessary in the settings of your own module to implement saving the value of the text_format field with the php code.
module mymodule. The file mymodule.module generates module settings with the form:
function mymodule_form($form, &$form_state, $arr = null) {
...
$form['tmpl_code'] = array(
'#type' => 'text_format',
'#title' => t('PHP code'),
'#format' => 'php_code',
);
...
}
function mymodule_form_submit($form, &$form_state)
{
$arr = array(
...
'php_code' => $form_state['values']['php_code'],
...
);
...
drupal_write_record('mymodule', $arr); //Здесь ошибка
...
}
...
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question