Created
April 10, 2013 10:30
-
-
Save wimleers/5353521 to your computer and use it in GitHub Desktop.
Quick hack in edit.module to demonstrate the problem.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Implements hook_library(). | |
*/ | |
function edit_library_info() { | |
print '<hr>'; | |
// Node -> EntityFormController | |
$entity = entity_load('node', 1); | |
var_dump($entity->getTranslation('und', FALSE)->get('field_tags')->getValue()); | |
$form = array(); | |
$form_state = array(); | |
field_attach_form($entity, $form, $form_state, 'und', array('field_name' => 'field_tags')); | |
drupal_prepare_form('form-id-here', $form, $form_state); | |
drupal_process_form('form-id-here', $form, $form_state); | |
var_dump($form['field_tags']['und']['#default_value']); | |
var_dump($form['field_tags']['und']['#value']); | |
print drupal_render($form); | |
print '<hr>'; | |
// CustomBlock -> EntityFormControllerNG | |
$entity = entity_load('custom_block', 1); | |
var_dump($entity->getTranslation('und', FALSE)->get('block_body')->getValue()); | |
$form = array(); | |
$form_state = array(); | |
field_attach_form($entity, $form, $form_state, 'und', array('field_name' => 'block_body')); | |
drupal_prepare_form('form-id-here', $form, $form_state); | |
drupal_process_form('form-id-here', $form, $form_state); | |
var_dump($form['block_body']['und'][0]['value']['#default_value']); | |
var_dump($form['block_body']['und'][0]['value']['#value']); | |
print drupal_render($form); | |
exit; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="page-wrapper"><div id="page"> | |
<header id="header" class="with-secondary-menu" role="banner"><div class="section clearfix"> | |
<nav id="secondary-menu" class="navigation" role="navigation"> | |
<h2 class="element-invisible">Secondary menu</h2><ul id="secondary-menu-links" class="links inline clearfix"><li class="menu-3 odd first"><a href="/patchtest/user">My account</a></li><li class="menu-18 even last"><a href="/patchtest/user/logout">Log out</a></li></ul> </nav> <!-- /#secondary-menu --> | |
<a href="/patchtest/" title="Home" rel="home" id="logo"> | |
<img src="http://localhost/patchtest/core/themes/bartik/logo.png" alt="Home" /> | |
</a> | |
<div id="name-and-slogan"> | |
<h1 id="site-name"> | |
<a href="/patchtest/" title="Home" rel="home"><span>patchtest</span></a> | |
</h1> | |
</div> <!-- /#name-and-slogan --> | |
<nav id="main-menu" class="navigation" role="navigation"> | |
<h2 class="element-invisible">Main menu</h2><ul id="main-menu-links" class="links clearfix"><li class="menu-270 odd first last active"><a href="/patchtest/" class="active">Home</a></li></ul> </nav> <!-- /#main-menu --> | |
</div></header> <!-- /.section, /#header --> | |
<div id="messages"><div class="section clearfix"> | |
<div class="messages error"> | |
<h2 class="element-invisible">Error message</h2> | |
<ul> | |
<li><em class="placeholder">Notice</em>: Undefined index: method in <em class="placeholder">drupal_prepare_form()</em> (line <em class="placeholder">1015</em> of <em class="placeholder">core/includes/form.inc</em>).</li> | |
<li><em class="placeholder">Notice</em>: Undefined index: method in <em class="placeholder">drupal_process_form()</em> (line <em class="placeholder">880</em> of <em class="placeholder">core/includes/form.inc</em>).</li> | |
<li><em class="placeholder">Notice</em>: Undefined index: rebuild in <em class="placeholder">drupal_process_form()</em> (line <em class="placeholder">988</em> of <em class="placeholder">core/includes/form.inc</em>).</li> | |
<li><em class="placeholder">Notice</em>: Undefined index: cache in <em class="placeholder">drupal_process_form()</em> (line <em class="placeholder">988</em> of <em class="placeholder">core/includes/form.inc</em>).</li> | |
<li><em class="placeholder">Notice</em>: Undefined index: method in <em class="placeholder">drupal_prepare_form()</em> (line <em class="placeholder">1015</em> of <em class="placeholder">core/includes/form.inc</em>).</li> | |
<li><em class="placeholder">Notice</em>: Undefined index: method in <em class="placeholder">drupal_process_form()</em> (line <em class="placeholder">880</em> of <em class="placeholder">core/includes/form.inc</em>).</li> | |
<li><em class="placeholder">Notice</em>: Undefined index: rebuild in <em class="placeholder">drupal_process_form()</em> (line <em class="placeholder">988</em> of <em class="placeholder">core/includes/form.inc</em>).</li> | |
<li><em class="placeholder">Notice</em>: Undefined index: cache in <em class="placeholder">drupal_process_form()</em> (line <em class="placeholder">988</em> of <em class="placeholder">core/includes/form.inc</em>).</li> | |
</ul> | |
</div> | |
</div></div> <!-- /.section, /#messages --> | |
<div id="main-wrapper" class="clearfix"><div id="main" class="clearfix"> | |
<main id="content" class="column" role="main"><section class="section"> | |
<a id="main-content"></a> | |
<hr><pre class='xdebug-var-dump' dir='ltr'> | |
<b>array</b> | |
0 <font color='#888a85'>=></font> | |
<b>array</b> | |
'tid' <font color='#888a85'>=></font> <small>string</small> <font color='#cc0000'>'3'</font> <i>(length=1)</i> | |
1 <font color='#888a85'>=></font> | |
<b>array</b> | |
'tid' <font color='#888a85'>=></font> <small>string</small> <font color='#cc0000'>'2'</font> <i>(length=1)</i> | |
2 <font color='#888a85'>=></font> | |
<b>array</b> | |
'tid' <font color='#888a85'>=></font> <small>string</small> <font color='#cc0000'>'1'</font> <i>(length=1)</i> | |
</pre><pre class='xdebug-var-dump' dir='ltr'><small>string</small> <font color='#cc0000'>'foo, bar, baz'</font> <i>(length=13)</i> | |
</pre><pre class='xdebug-var-dump' dir='ltr'><small>string</small> <font color='#cc0000'>'foo, bar, baz'</font> <i>(length=13)</i> | |
</pre><form action="/patchtest/" method="post" id="form-id-here" accept-charset="UTF-8"><div><div class="field-type-taxonomy-term-reference field-name-field-tags field-widget-taxonomy-autocomplete form-wrapper" id="edit-field-tags"><div class="form-item form-type-textfield form-item-field-tags-und"> | |
<label for="edit-field-tags-und">Tags</label> <input aria-describedby="edit-field-tags-und--description" class="form-autocomplete form-text" type="text" id="edit-field-tags-und" name="field_tags[und]" value="foo, bar, baz" size="60" maxlength="1024" placeholder="" /><input class="autocomplete" id="edit-field-tags-und-autocomplete" type="hidden" value="http://localhost/patchtest/taxonomy/autocomplete/field_tags" /> | |
<div class="description" id="edit-field-tags-und--description">Enter a comma-separated list of words to describe your content.</div> | |
</div> | |
</div><input type="hidden" name="form_build_id" value="form-iu815gljAWECk4cOu7MYA_p1qXzagBDADJ8eM1BfRLY" /><input type="hidden" name="form_token" value="ls1PCmt8vtRD61YsL5kaJlZXoSNOXTG_-zEpuCojhMk" /><input type="hidden" name="form_id" value="form-id-here" /></div></form><hr><pre class='xdebug-var-dump' dir='ltr'> | |
<b>array</b> | |
0 <font color='#888a85'>=></font> | |
<b>array</b> | |
'value' <font color='#888a85'>=></font> <small>string</small> <font color='#cc0000'>'<p>CUSTOM BLOCK OW YEAH</p> | |
'</font> <i>(length=29)</i> | |
'format' <font color='#888a85'>=></font> <small>string</small> <font color='#cc0000'>'basic_html'</font> <i>(length=10)</i> | |
'summary' <font color='#888a85'>=></font> <small>string</small> <font color='#cc0000'>''</font> <i>(length=0)</i> | |
'safe_value' <font color='#888a85'>=></font> <small>string</small> <font color='#cc0000'>'<p>CUSTOM BLOCK OW YEAH</p>'</font> <i>(length=27)</i> | |
'safe_summary' <font color='#888a85'>=></font> <small>string</small> <font color='#cc0000'>''</font> <i>(length=0)</i> | |
</pre><pre class='xdebug-var-dump' dir='ltr'><font color='#3465a4'>null</font> | |
</pre><pre class='xdebug-var-dump' dir='ltr'><small>string</small> <font color='#cc0000'>''</font> <i>(length=0)</i> | |
</pre><form action="/patchtest/" method="post" id="form-id-here--2" accept-charset="UTF-8"><div><div class="field-type-text-with-summary field-name-block-body field-widget-text-textarea-with-summary form-wrapper" id="edit-block-body"><div id="block-body-add-more-wrapper"><div class="text-format-wrapper form-item"><div class="text-summary-wrapper"></div><div class="form-item form-type-textarea form-item-block-body-und-0-value"> | |
<label for="edit-block-body-und-0-value">Block body</label> <div class="form-textarea-wrapper"><textarea class="text-full form-textarea resize-vertical" id="edit-block-body-und-0-value" name="block_body[und][0][value]" rows="9" cols="60" placeholder=""></textarea></div> | |
</div> | |
<div class="filter-wrapper form-wrapper" id="edit-block-body-und-0-format"><div class="filter-help form-wrapper" id="edit-block-body-und-0-format-help"><p><a href="/patchtest/filter/tips" target="_blank">More information about text formats</a></p></div><div class="form-item form-type-select form-item-block-body-und-0-format"> | |
<label for="edit-block-body-und-0-format--2">Text format</label> <select class="filter-list editor form-select" data-editor-for="edit-block-body-und-0-value" id="edit-block-body-und-0-format--2" name="block_body[und][0][format]"><option value="basic_html" selected="selected">Basic HTML</option><option value="restricted_html">Restricted HTML</option><option value="full_html">Full HTML</option></select> | |
</div> | |
<div class="filter-guidelines form-wrapper" id="edit-block-body-und-0-format-guidelines"><div class="filter-guidelines-item filter-guidelines-basic_html"><h4 class="label">Basic HTML</h4><ul class="tips"><li>Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd> <h4> <h5> <h6> <p> <span> <img></li><li>Only images hosted on this site may be used in <img> tags.</li></ul></div><div class="filter-guidelines-item filter-guidelines-restricted_html"><h4 class="label">Restricted HTML</h4><ul class="tips"><li>Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd> <h4> <h5> <h6></li><li>Lines and paragraphs break automatically.</li><li>Web page addresses and e-mail addresses turn into links automatically.</li></ul></div><div class="filter-guidelines-item filter-guidelines-full_html"><h4 class="label">Full HTML</h4></div></div></div></div> | |
</div></div><input type="hidden" name="form_build_id" value="form-2q-eNkN0NPGDRYzOZaASq_IadMDd8_caIx2XeuzSMBM" /><input type="hidden" name="form_token" value="ls1PCmt8vtRD61YsL5kaJlZXoSNOXTG_-zEpuCojhMk" /><input type="hidden" name="form_id" value="form-id-here" /></div></form> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment