I need to add a paragraph of text near the top of the user profile page found at /user, this is page you are initially taken to after login.
I'm not fluent with Drupal, and I can't find any answers online.
Could any advise how I can add text to the user profile page?
you can also add a block to the "content area" to be shown below the user profile (restricted to user/* pages). In the block you an use short PHP snippets.
In a custom Drupal module you could use hook_form_FORM_ID_alter(), this will let you change the user profile form, where you could attach a div element that will hold the paragraph text you wish to insert to the page. You will also give weight to your div, so that it is displayed on top of the form.
Here is a code snippet:
function custommodulename_form_user_profile_form_alter() {
$description_html = '<div>Lorem ipsum...</div>';
$form['description'] = array(
'#markup' => $description_html,
'#weight' => -10,
);
}
Related
I have a button in the table in the first page. When I click on the button, I want to save the panel Id and display on the next page. How can I call the data in angular? I'm desperately seeking for help since I'm stuck in there for almost a week now.
These are the images for my problem.
enter image description here
So this one is the first page, where there are buttons in each row.
After clicking Assign, it should show readonly data of ship name and panel name.
enter image description here
Regarding your issue, you should get the panel_id from params in the URL.
E.g.
In the routing of the assigning page, you just set the path:
{
path: 'assigning/:id',
component: <YourComponent>
}
So you can get the panel_id by using ActivatedRoute.
On click event of "Assign" button, you can pass the value to the ts component. In the ts file you can pass it via URL route as a parameter to the next page or store it in localStorage and read from the next page.
<button (click)="passValue(value)">Assign</button>
I am using Chronoform V5 for my Joomla site. I have created a Multi Page form wherein a user will fill in each page and click next to proceed and at the end the form will be finally submitted and some results will be displayed based on the input. This part works fine.
Now I have a dropdown in first page. If a user selects e.g, option 'a' and clicks 'next page' button i want to hide a dropdown in the second page. In case the user selects option 'b' in the first page this dropdown in second page should be visible.
Any idea how to achieve this?
I would use a Custom code action to check the submitted value and use CSS to show or hide the value:
<?php
$display = 'block';
if ( $form->data['var_name'] == 'xxx' ) {
$display = 'none';
}
$style = "#some_id { display: '{$display}'; }";
$jdoc = \JFactory::getDocument();
$jdoc->addStyleDeclaration($style);
?>
I want to remove the sidebar from the specific page and all its subsequent pages in Drupal 7
My code is mention below.code is in mytheme_preprocess_node(&$variables) function
if ($variables['type'] === 'project'){
$node = $variables['node'];
if($node->type=='project'){
//print_r($node);
echo $node->type;
unset($page['sidebar_second']);
}
why don't you create a tpl file for that specific content type and remove the sidebar from there ? just an idea
Try restricting the block in Blocks UI or with the Context module.
You can restrict that sidebar content in admin panel itself. login as admin and configure that sidebar block to display only on perticular url.
Working on Drupal, I have a page with a form made with "Webform" module, containing several fields (text fields and sliders) and a "Submit" button.
When the user enters the information and presses the "Submit" button, another page is loaded with custom code into it.
The new page is devided into 2 parts - the first one contains new information(based on the user input from the previous page); the second one contains (block) the same form, used in the previous page.
Is there a way to load the values, filled in the form from the first page into the new page?
First of all you would need to make a custom module, with the help of
hook_form_alter
You would need to store the previous form's information in cookies with prefix
Drupal_visitor_
and then display it in the new page like:
$form['submitted']['FirstName']['#default_value'] =
$_COOKIE[$firstname];
Thanks
Is there a way I can fully customize a page in Drupal? I don't want the Drupal header or any other HTML generated by Drupal to show up, but I want to be able to access the Drupal functions.
Basically you want a new page template (as opposed to a node template). This does not quite work out of the box in Drupal 7 so there are a few steps:
Step 1
Create a new content type for this specially themed page, call it "special" or whatever...
Step 2
Add this code to your theem's template.php file. (Replace "yourthemename" in the code below with your theme's machine name, that is to say the name of your theme folder in /sites/all/)
function yourthemename_preprocess_page(&$vars) {
if (isset($vars['node']->type)) {
$vars['theme_hook_suggestions'][] = 'page__' . $vars['node']->type;
}
}
Step 3
Create a new page template in your theme folder and name it after the new content type. so for example: page--special.tpl.php and "special" being the name of the content type. Customize away!
Step 4
Clear cache
Step 5
Create a new peice of content using your new content type -- it will be in the design of your new page template.
The end result will be like having a completely separate theme but staying within your existing theme.
Note, I wrote a blog post on how to do this for Drupal 6 but if you read down the comments, there are ideas and links how do this for D7 but basically what I have said here.
http://highrockmedia.com/blog/creating-custom-content-type-page-templates-drupal-php
You can run an alernative page.tpl.php file. Eg. page--front.tpl.php
Not sure it's the best way to do this but it will work. You can strip anything you don't want out of the file so it is totally different to other pages.
Drupal is pretty flexible:
<?php
$json = array(
'body' => 'This is the body of the page.',
'title' => 'This is the page title',
);
return drupal_json_output($json);
?>