Re: Field invisible

Muzaffer Tolga Ozses <[email protected]> Wed, 4 Feb 2015 11:15:31 +0200
Newsgroups gmane.comp.php.drupal.devel
Message-ID <CAMAQ3nKY9E+YAuMieu925S43ELjYCt4YwBnE8rLws4B9M_8-bA@mail.gmail.com>
--001a1134f0a2114d68050e3fa197
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

Thank you Eric for replying,

Like I said, this started happening after I renamed the field. Could this
be why?

On 4 February 2015 at 10:52, Erik Stielstra <[email protected]> wrote:

> Hi mto,
>
> I can not reproduce your problem. I copied the code in hello.install,
> renamed the function to hello_install(), enabled the module and the field
> was visible in the account form and the user page. Try you code again in =
on
> a D7 core, out of the box. Is must be some interaction with other code or
> styling.
>
> Regards,
> Erik Stielstra
>
>
>
> > On 4 feb. 2015, at 08:35, Muzaffer Tolga Ozses <[email protected]> wrote:
> >
> > Hi,
> >
> > I've got the below code. After enabling the module, the field is seen
> disabled in /admin/config/people/accounts/display/full. Furthermore, even
> if I enable it, it is not on user account page, even though it is visible
> in dpm() output. This started happening after I changed the field name.
> >
> > <?php
> > /**
> >  * Implements hook_install().
> >  */
> > function tckn_kontrol_install() {
> >   $field =3D array(
> >     'field_name' =3D> 'field_tckn',
> >     'type' =3D> 'text',
> >     'settings' =3D> array(
> >       'max_length' =3D> 11,
> >     ),
> >   );
> >   $instance =3D array(
> >     'field_name' =3D> 'field_tckn',
> >     'entity_type' =3D> 'user',
> >     'bundle' =3D> 'user',
> >     'required' =3D> TRUE,
> >     'label' =3D> t('TCKN'),
> >     'description' =3D> t('Enter your TCKN.'),
> >     'settings' =3D> array(
> >       'user_register_form' =3D> TRUE,
> >     ),
> >     'display' =3D> array(
> >       'default' =3D> array(
> >         'label' =3D> 'above',
> >         'type' =3D> 'text_textfield',
> >       ),
> >     ),
> >     'widget' =3D> array(
> >       'settings' =3D> array(
> >         'size' =3D> 12,
> >       ),
> >     ),
> >   );
> >   field_create_field($field);
> >   field_create_instance($instance);
> > }
> > function tckn_kontrol_uninstall() {
> >   $instance =3D array(
> >     'field_name' =3D> 'field_tckn',
> >     'bundle' =3D> 'user',
> >     );
> >   field_delete_field($instance['field_name']);
> > }
> >
> > =E2=80=8BThank you in advance for replying.=E2=80=8B
> >
> > --
> > mto
>
>


--=20
mto

--001a1134f0a2114d68050e3fa197
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div class=3D"gmail_default" style=3D"font-family:courier =
new,monospace">Thank you Eric for replying,</div><div class=3D"gmail_defaul=
t" style=3D"font-family:courier new,monospace"><br></div><div class=3D"gmai=
l_default" style=3D"font-family:courier new,monospace">Like I said, this st=
arted happening after I renamed the field. Could this be why?</div></div><d=
iv class=3D"gmail_extra"><br><div class=3D"gmail_quote">On 4 February 2015 =
at 10:52, Erik Stielstra <span dir=3D"ltr">&lt;<a href=3D"mailto:info@eriks=
tielstra.nl" target=3D"_blank">[email protected]</a>&gt;</span> wrote:<=
br><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left=
:1px #ccc solid;padding-left:1ex">Hi mto,<br>
<br>
I can not reproduce your problem. I copied the code in hello.install, renam=
ed the function to hello_install(), enabled the module and the field was vi=
sible in the account form and the user page. Try you code again in on a D7 =
core, out of the box. Is must be some interaction with other code or stylin=
g.<br>
<br>
Regards,<br>
Erik Stielstra<br>
<div class=3D"HOEnZb"><div class=3D"h5"><br>
<br>
<br>
&gt; On 4 feb. 2015, at 08:35, Muzaffer Tolga Ozses &lt;<a href=3D"mailto:t=
[email protected]">[email protected]</a>&gt; wrote:<br>
&gt;<br>
&gt; Hi,<br>
&gt;<br>
&gt; I&#39;ve got the below code. After enabling the module, the field is s=
een disabled in /admin/config/people/accounts/display/full. Furthermore, ev=
en if I enable it, it is not on user account page, even though it is visibl=
e in dpm() output. This started happening after I changed the field name.<b=
r>
&gt;<br>
&gt; &lt;?php<br>
&gt; /**<br>
&gt;=C2=A0 * Implements hook_install().<br>
&gt;=C2=A0 */<br>
&gt; function tckn_kontrol_install() {<br>
&gt;=C2=A0 =C2=A0$field =3D array(<br>
&gt;=C2=A0 =C2=A0 =C2=A0&#39;field_name&#39; =3D&gt; &#39;field_tckn&#39;,<=
br>
&gt;=C2=A0 =C2=A0 =C2=A0&#39;type&#39; =3D&gt; &#39;text&#39;,<br>
&gt;=C2=A0 =C2=A0 =C2=A0&#39;settings&#39; =3D&gt; array(<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0&#39;max_length&#39; =3D&gt; 11,<br>
&gt;=C2=A0 =C2=A0 =C2=A0),<br>
&gt;=C2=A0 =C2=A0);<br>
&gt;=C2=A0 =C2=A0$instance =3D array(<br>
&gt;=C2=A0 =C2=A0 =C2=A0&#39;field_name&#39; =3D&gt; &#39;field_tckn&#39;,<=
br>
&gt;=C2=A0 =C2=A0 =C2=A0&#39;entity_type&#39; =3D&gt; &#39;user&#39;,<br>
&gt;=C2=A0 =C2=A0 =C2=A0&#39;bundle&#39; =3D&gt; &#39;user&#39;,<br>
&gt;=C2=A0 =C2=A0 =C2=A0&#39;required&#39; =3D&gt; TRUE,<br>
&gt;=C2=A0 =C2=A0 =C2=A0&#39;label&#39; =3D&gt; t(&#39;TCKN&#39;),<br>
&gt;=C2=A0 =C2=A0 =C2=A0&#39;description&#39; =3D&gt; t(&#39;Enter your TCK=
N.&#39;),<br>
&gt;=C2=A0 =C2=A0 =C2=A0&#39;settings&#39; =3D&gt; array(<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0&#39;user_register_form&#39; =3D&gt; TRUE,<b=
r>
&gt;=C2=A0 =C2=A0 =C2=A0),<br>
&gt;=C2=A0 =C2=A0 =C2=A0&#39;display&#39; =3D&gt; array(<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0&#39;default&#39; =3D&gt; array(<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&#39;label&#39; =3D&gt; &#39;above&#3=
9;,<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&#39;type&#39; =3D&gt; &#39;text_text=
field&#39;,<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0),<br>
&gt;=C2=A0 =C2=A0 =C2=A0),<br>
&gt;=C2=A0 =C2=A0 =C2=A0&#39;widget&#39; =3D&gt; array(<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0&#39;settings&#39; =3D&gt; array(<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&#39;size&#39; =3D&gt; 12,<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0),<br>
&gt;=C2=A0 =C2=A0 =C2=A0),<br>
&gt;=C2=A0 =C2=A0);<br>
&gt;=C2=A0 =C2=A0field_create_field($field);<br>
&gt;=C2=A0 =C2=A0field_create_instance($instance);<br>
&gt; }<br>
&gt; function tckn_kontrol_uninstall() {<br>
&gt;=C2=A0 =C2=A0$instance =3D array(<br>
&gt;=C2=A0 =C2=A0 =C2=A0&#39;field_name&#39; =3D&gt; &#39;field_tckn&#39;,<=
br>
&gt;=C2=A0 =C2=A0 =C2=A0&#39;bundle&#39; =3D&gt; &#39;user&#39;,<br>
&gt;=C2=A0 =C2=A0 =C2=A0);<br>
&gt;=C2=A0 =C2=A0field_delete_field($instance[&#39;field_name&#39;]);<br>
&gt; }<br>
&gt;<br>
&gt; =E2=80=8BThank you in advance for replying.=E2=80=8B<br>
&gt;<br>
&gt; --<br>
&gt; mto<br>
<br>
</div></div></blockquote></div><br><br clear=3D"all"><div><br></div>-- <br>=
<div class=3D"gmail_signature"><div dir=3D"ltr"><div><div dir=3D"ltr">mto</=
div></div></div></div>
</div>

--001a1134f0a2114d68050e3fa197--