texts: Using hook_entity_base_field_info for adding new field

texts:
Is it fine to implement hook_entity_base_field_info to add a new field to the advanced group in each node?

If so, how is the storage handled by default for base fields? Should I need to create a schema to store the field value.


texts: Form submission not saved when using a dynamic redirect

texts:
I have forms where I use a form alter to set various form fields on the fly.
One of which is the Thank You page field that a user should go to after submitting.
Example $form['submitted']['thankyou_page']['#value'] = 'my_page';
I use the same form for multiple reasons so setting the thank you page to suit.
After setting these (which work fine) I then enter a function to do some processing of the form fields to a CRM.
The final section of this function is like this
try {
    $result = $client->CreateContact($data);
} catch (Exception $e) {
    $result = $e;
}
  my_submit_handler2($values['thankyou_page']); // redirect
}
}

The processing works fine to CRM but my problem is that the form submission (result) doesn't save in Drupal and the auto-emails after submit fail to send too.
The redirect is done like this
function my_submit_handler2($f) {
  drupal_goto($f);
}

So I guess the submission is being interrupted?
How can I do these redirects without affecting the flow of the form submission?


texts: Page title and body field of specific page

texts:
I have a page--front.html.twig file. I can't figure out how to show a specific node title and body summary on the frontpage with only using twig. I know I can create a view of something like that and show it with: {{ drupal_view('viewmachinename', 'blockname') }}, but in my opinion it's a little bit overkill for just showing the title and body of specific node.
Normally I show the current node title and body summary with {{ node.label }} and {{node.body.summary}}, but I don't know how to show the page title and body summary with an other nid.
I try to show the page title and body summary with nid 2 on the frontpage.


texts: Drush error when running dmu-analyze to update drupal modules

texts:
I'm using drupal module upgrader with drush to update the modules which are drupal 7 compatible at the moment. I'm getting this error when I try running drush dmu-analyze MODULE_NAME

I can't seem to find a solution on the net to fix this issue. I have tried re-installing the module or drush. Even when I type drush status I'm also getting this error.


texts: how do i create a subscribe or join group link in drupal 7?

texts:
I am trying to create a join or subscribe link for groups on my site but i don't know how to go about it (using views). I want to create something similar to this http://www.popsugar.com/community/suggest .

Any suggestions?


texts: What is the reason of hidding comments and links in node.tpl.php?

texts:
What is the reason of first hiding the comments and links and later showing theme in node.tpl.php?

even if I delete following three lines of this system it does not change anything,
hide($content['comments']);
hide($content['links']);
<?php print render($content['comments']); ?>

from node.tpl.php

    <div class="content clearfix"<?php print $content_attributes; ?>>
            <?php
              // We hide the comments and links now so that we can render them later.
              hide($content['comments']);
              hide($content['links']);
              print render($content);
            ?>

          <?php
            // Remove the "Add new comment" link on the teaser page or if the comment
            // form is being displayed on the same page.
            if ($teaser || !empty($content['comments']['comment_form'])) {
              unset($content['links']['comment']['#links']['comment-add']);
            }
            // Only display the wrapper div if there are links.
            $links = render($content['links']);
            if ($links):
          ?>

              <?php print $links; ?>

          <?php endif; ?>

          <?php print render($content['comments']); ?>


texts: Programmatically creating a content type with file field in a custom module

texts:
I'm writing a custom module, which I've done before, but this is the first time I've tried to create a content type with fields. I implemented hook_node_info and the Content Type is showing up in the list of Content types in the dropdown from admin_menu, however, when I browse to admin/structure/types it is not listed.

I implemented hook_install and grabbed some code I found on another SO question. I have the code print out some debug info to my error log and it LOOKS like it all works, but when I browse to the Structure Content Type it doesn't show the field I added.

Here are hooks:

function mymod_node_info() {
  return array(
    'mymod_content' => array(
      'name' => t('My Mod'),
      'base' => 'mymod_content',
      'description' => t('A Description'),
    )
  );
}

function mymod_install() {
    error_log('mymod_install');
    $types = node_type_get_types();

    if ( ! field_info_field('field_mymod_myfile') ) {
        $field = array(
            'field_name' => 'field_mymod_myfile',
            'type' => 'file',
        );
        $created_field = field_create_field($field);
        error_log('---- field_create_field -----');
        error_log(var_export($created_field, true));
    }

    $instance = array(
        'field_name' => 'field_mymod_myfile',
        'entity_type' => 'mymod_content',
        'bundle' => 'mymod_content',
        'required' => TRUE,
    );
    $created_instance = field_create_instance($instance);
    error_log('---- field_create_instance -----');
    error_log(var_export($created_instance, true));
}

I can see a table called field_data_field_mymod_myfile in the database, so I know the first part worked. However, the table is empty.

The error log shows the field_create_instance() method returned this:

array (
  'field_name' => 'field_mymod_myfile',
  'entity_type' => 'mymod_content',
  'bundle' => 'mymod_content',
  'required' => true,
  'field_id' => '5',
)

Why doesn't my field show up on this content type?


texts: How to output a screen from a submit handler? (D7)

texts: Based upon a form's values In my submit handler I build the output screen and display it with a drupal_set_message();. I'm trying to figure out how to display the information on a page. I can't find any examples. I've created a theme, which is probably unnecessary, but again, I don't know how to display it.


texts: Loop through multiple values from an array to create multiple arrays

texts:
I have $host_entity which contains:
field_eventorganizer (Array, 1 element)
und (Array, 3 elements)
0 (Array, 1 element)
target_id (String, 2 characters ) 20
1 (Array, 1 element)
target_id (String, 4 characters ) 345
2 (Array, 1 element)
target_id (String, 2 characters ) 678

and the below code in which I need to create multiple arrays inside the array('#markup'.
$organisers=user_load($host_entity->field_eventorganizer['und'][0]['target_id']);
$organiser_email=$organisers->mail;
    $build['field_eventorganizer'] = array(
    '#theme' => 'registration_property_field',
    '#label' => 'Event Organiser(s)',
    '#items' => array(
        array('#markup' => l($username, 'mailto:' . $organiser_email, array('absolute' => TRUE)),),
        ),
        '#classes' => 'field field-label-inline clearfix',
    );

Do I need to create a foreach loop after array('#markup' => ?


texts: How can I get a list of all available entity view modes?

texts:
I need to have a list of all available view modes for an entity type so I can use it as the #options in a select field.

Any ideas?
Thanks


texts: How can I call javascript from another site?

texts:
I recently started working in collaboration with another drupal website, and we are trying to figure out how to get some of their content embedded into my site. They sent my some embed code for a widget, which is below (with some pieces changed for privacy:

<script type="text/javascript">
  widgetContext = { "url": "http://theirsite.com/mysite/[nid]", "width": "600", "height": 200, "widgetid": "web_widget_iframe_hash" };
</script>
<script id="web_widget_iframe_hash" src="http://theirsite.com/sites/all/modules/web_widgets/iframe/web_widgets_iframe.js">
</script>

The problem is that I cannot figure out how to get this embedded into my site. The widget generates calendars for venues, so the content is going to change based on which node is being viewed on my site. So, in my nodes, I added a field that stores the NID of the corresponding node on the other site so that the correct calendar is generated.

I'm trying to create a view, in order to dynamically call the above script for each page on my site. The view uses a token to take the NID field and place it into the first part of the script. However, when I place this code into a Custom Field, views strips the script tags and displays the rest of it as text. When I try to place it into a PHP field, it doesn't display at all.

Does anybody have a suggestion for how I can use the above code on my site? I'm at a bit of a loss.


texts: Some tags in the output from my controller are filtered away

texts:
I have a controller defined in MODULE.routing.yml which returns:

return array(
      '#type' => 'markup',
      '#markup' => $this->content(),
      '#attached' => array(
        'library' => $libs,
      ),
    );

The content contains H2, INPUT and SELECT (amongst others). The INPUT and SELECT are removed so I guess there's an input filter being run on this markup.

How do I control the input filter for this controller and/or disable it completely?


texts: How to import content in markdown format?

texts:
I have text in markdown format. How should I go about importing this into my site? I would think a Feeds Tamper plugin to convert markdown to html would be ideal.

Does such a thing exist? Is there a straightforward way to convert markdown to html in Drupal?


texts: Drupal 7 - Any module for storing profile as nodes?

texts:
I am currently using profile2 but I need to save the revisions too which is currently not possible in profile2.

Is there any other module or approach to achieve this?


texts:
My web server company recently reported me that my website is sending spams. I scanned the whole file system and found a number of infected php files like index.main.php, ipopup.php and  wtm9309n.php in sites/default/files directory.

All permissions for files and directories are set correctly. I have only one custom content type having 2 textbox fields that all users can create a new content of that type.

I checked the files table in database. except my uploaded files, there was no other files listed there, so (I think) that means the infected files are not uploaded via upload forms.

This is the only infected website among of the tens in my web server, so I think this a problem with this website instead of other things like OS vulnerabilities and ...

Enabled modules:

admin
cck
contact_forms
faq
filefield
imageapi
imagecache
imagefield
imce
nice_menus
node_export
views

Any suggestion? (Drupal 6.20)


texts: How a field collection item is linked to a node

texts:
I was looking through the database for a field_collection_item, but am still confused how it is actually linked to a node.

field_collection_item has 2 fields item_id and field_name

It seems item_id uniquely identifies a field collection item and field name is the machine name of the field_collection. Where do I find a table that links entity_id's (field collections) to nodes?


texts: I have a decimal field in my node that I need to display it as percentage through views. I thought about adding another field 100 and multiply them by using the computed field module. I was wondering if there is a better way.


texts: Odd problems with Drupal 8.7.7 and drupal/jsonapi 2.4.0

texts:
I share a release branch with a team of developers and I am the only one having this problem locally (see below).

$ git reset --hard origin/2019-Oct-R2
HEAD is now at 8e5cec59b1 WWW-1599 update spoke service definition and update jsonapi module
$ git status
On branch 2019-Oct-R2
Your branch is up to date with 'origin/2019-Oct-R2'.

nothing to commit, working tree clean

At this point I am on the latest release branch with no tracked or untracked files (same as my colleagues), I then try this:

$ composer update nothing
Gathering patches for root package.
> DrupalProject\composer\ScriptHandler::checkComposerVersion
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Conclusion: remove drupal/core 8.7.7
    - Conclusion: don't install drupal/core 8.7.7
    - don't install drupal/core 8.7.7|remove drupal/jsonapi 2.4.0
    - don't install drupal/jsonapi 2.4.0|don't install drupal/core 8.7.7
    - don't install drupal/jsonapi 2.4.0|don't install drupal/core 8.7.7
    - Installation request for drupal/core 8.7.7 -> satisfiable by drupal/core[8.7.7].
    - Installation request for drupal/jsonapi (locked at 2.4.0, required as ^2.4) -> satisfiable by drupal/jsonapi[2.4.0].

Can anyone interpret this error message for me?


texts: How can I save the configuration value in a custom submit form method

texts:
I've been wondering if it was possible to use the configuration system instead of playing directly with the database. Here's a simplified version of what I'm trying to achieve:

public function blockForm($form, FormStateInterface $form_state) {
    $form = parent::blockForm($form, $form_state);
    $form['action'] = array(
        '#type' => 'submit',
        '#submit' => [[$this, 'myMethod']],
        '#value' => $this->t('Test')
    );
    return $form;
}

public function myMethod($form, FormStateInterface $form_state) {
    $this->setConfigurationValue('my_config', 'my test value!');
    $this->saveConfiguration(); // <---- Is that 'kind of' possible?
}

So, I was wondering if it was possible to get the real "config class" by some way and call $config->save(). I started to look at the source and I think it's probably possible using the configuration engine.

Any help would be appreciated.

Thanks


texts: Global $user object isn't always "Fully Loaded"

texts:
I have a Drupal 6 module that implements hook_user() to add a custom property on op='load';

mymodule_user($op, &$edit, &$account, $category = NULL) {
  $account->external_id = mymodule_get_user_external_id($account->uid);
}

In modules, I access the global $user object. What I find is sometimes it has my ->external_id property, and sometimes it doesn't.

As a result, I end up having to check to see if my custom property is set, and if not, call user_load()

if(isset($GLOBALS['user']->external_id)) {
  $account = $GLOBALS['user'];
} else {
  $account = user_load($GLOBALS['user']->uid);
}

Yuck! Is this a known problem, or does it sound like I'm doing something wrong?


texts: How to send an email to the node author when a date is approaching?

texts:
The user has created a node and has set a future date to be alerted of the approach of this date.

I want the user receive an email when the set date is approaching.

Making the user able to change the approaching time would be great.
Any sugestions?


texts:
I am having the errors in console for jQuery UI. The jQuery Update module (7.x-2.4) is being used in my theme, and I have no idea why it is not including the jQuery UI. The following is the screenshot of the errors I get. In the view source I don't find jqueryui.js.

It happens in all the browsers. I also tried using the files from the jQuery CDN, but it didn't work at all. These errors are creating many troubles in the admin area. Many things aren't working: The Views interface is broken and the MD Slider is broken.


texts: Allowed memory size of 134217728 bytes exhausted in system\image.gd.inc reported for styled images

texts:
There is a content type in my website that has an image field. Some contents have images that are larger than 20MB.

I created an image_style called fp which scales and resizes the images in 800X400px it works well but when the browser displays this resized version it reports the following error

  Allowed memory size of 134217728 bytes exhausted (tried to allocate 73834563 bytes) in modules/system/image.gd.inc on line 237

I know by increasing the memory_limit the problem will be solved (even though it is not recommended).

From what I know Drupal creates a distinct file of the original image for every image style, so in sites/default/files/styles/fp there is a resized version of the original image. It means when browser displays the resized image, the PHP needs no process to resize the image, it only displays another image which is the resized version. But why it displays the above error while it only needs to display an image (styled version) which its size is about 200kb ?


texts: Is hook_file_download the right hook for taking action when a private file is downloaded?

texts:
I'm trying to create a module that will fire send an event via google analytics' Measurement Protocol API when a file is downloaded.  These files are all in the private file system outside of the document root.

hook_file_download looks like a somewhat likely candidate for triggering an http request to google analytics, but since the hook is responsible for access, it seems possible that another module might deny access after this version of the hook is run, and google analytics would get an event even in cases where the download didn't go through.  If there a better hook that would be run after all the access check have finished?  I should probably mention that I am using the media module.

Supplementarily, the existence of both hook_file_download and hook_file_download_access is confusing since they both claim to control access to files.  Is it a correct understanding that hook_file_download_access basically controls whether a user has access in relation to the entity the file is attached to (so likely would control whether the download link is displayed at all or not), and hook_file_download only applies to private files, and checks on access after a request for the file has been made?

Follow Up

I ended up implementing two hooks: hook_file_download and hood_file_transfer which as far as I could tell is undocumented in the drupal api site as a hook.  Both of those hooks calls a function passing the $uri parameter which in turn builds the google analytics request and then sends an http request.  That seems to cover the two different cases when a file download passes through drupal for my setup.


texts: path alias for 'edit' not loading correct page under 'admin/'

texts:
I have a content page that just editors need to see. So I set the pathauto to something like 'admin/page-title'. The edit-path is 'admin/page-title/edit' accordingly.

When trying to open the node in edit mode however, the first page of admin section is displayed instead of the edit form – as found under 'admin/'.

This basically is not really a problem – just took me some time to figure out that actually the 'admin' part of the URL is causing the problem. I would however really like to keep that URL structure since it would make the path consistent to the actual internal content structure.  Any suggestion how I could get this work? Any pointers would be gladly appreciated.


texts: Unusual renewal of subscription products

texts:
Marketing wants to sell a subscription product at a discounted price of 5 septims a year for 3 years, and then return it to its regular price of 10 septims after that.

In discussion the idea came up to:

Generate 3 new products (SUB_Y1, SUB_Y2, and SUB_Y3 in addition to the existing SUB product)
Set up the renewals notifications for the first 3 products to encourage users to renew
Direct them only to the next product in the series
Offer them the regular product after the first 3 cheap years

However, I know my marketing department; if I do this, they will want more, and by the end of the year I will have 25 different series, each of which having 2 to 5 steps in the process. My /admin/store/products/view will be a nightmare to behold.

Is there a cleaner way of handling this that will not use up much of the 25 minutes actual coding time I am alotted each week?


texts: How to implement something like OG which the groups can manage on their own?

texts:
I'm building a learning tracking site for a community where Mentors will match up with Mentees. I'd like them to create either an organic group or a paired relationship to share content (seen only by the two of them plus a supervisor, observer, or instructor).

The catch is I'd like to let them do it on their own. In other words, I'd like to "get out of the way" and not maintain the actual groupings.

Does this sound like a job more for Organic groups (OG) or User Relationships? Is there another technique that could get the job done more smoothly?

And, how can they share content only amongst those with in that group or relationship?

If I use OG, how can I best let users create and invite others without my intervention?


texts:
Problem

I'm trying to use XHProf but I'm getting horrible php error every time it runs.

Warning: Invalid argument supplied for foreach() in xhprof_compute_inclusive_times() (line 1670 of /var/www/drupal/sites/all/modules/XHProf/xhprof.inc).
Warning: Invalid argument supplied for foreach() in xhprof_compute_flat_info() (line 1644 of /var/www/drupal/sites/all/modules/XHProf/xhprof.inc).
Warning: Invalid argument supplied for foreach() in theme_xhprof_overall_summary() (line 367 of /var/www/drupal/sites/all/modules/XHProf/xhprof.module).

The problem is solved here because the temporary folder doesn't exist, however mine does.

Set-Up Server Side

I'm running a fresh Ubuntu Server 13.04 with Drupal 7.

Install xhprof using pear following the instructions here.
I also added a temporary directory to php.ini, which I created manually.

extension=xhprof.so
xhprof.output_dir="/var/tmp/xhprof"

Drupal Set-Up

I have both the devel installed and I also installed the XHProf module.

In admin/config/development/xhprof, I enabled profiling of all page views and drush requests.

On following an xhprof link I get the error above.


texts: Is there a pre-styled Omega subtheme out there?

texts:
I am after a theme that looks good out of the box and I don't need to make a lot of theming changes. The customer is not fussed about the styling but obviously doesn't want a stark/bare looking site either. The omega theme fits the bill functionality wise, it's responsive and the regions/sections suit us. However, it is way too bare/stark. I've so far tried Omega kickstart, omega and omega-alpha.

Any suggestions on a pre styled free theme I can used that is based on the Omega "framework"?


texts: Drupal 7 Homebox module and Twitter Bootstrap theme

texts:
I am using Drupal Homebox module (https://drupal.org/project/homebox, version 7.x-2.0-beta6) to create a dashboard. I've found an issue that the save function to keep the status/location of blocks on the dashboard (closing or moving) doesn't work when using Twitter bootstrap theme. But there is no problem when using Batik theme. I could not find any clues of what cause this issue.

Any help would be greatly appreciated!


texts: How to properly add inline Javascript code to a webform with javascript injector module

texts:
I have recently started leaning Drupal 7. I have built my first Webform and I'd like to add a field that calculates automatically number of days between two dates as shown in below  I tried to follow this tutorial but I didn't understand it so I tried to use the module js injector to solve the problem!

This is the JS injection rule that I used

jQuery(document).ready(function($) {

$( "#edit-submitted-startdate,#edit-submitted-enddate" ).datepicker({
changeMonth: true,
changeYear: true,
firstDay: 1,
dateFormat: 'dd/mm/yy',
})

$( "#edit-submitted-startdate" ).datepicker({ dateFormat: 'dd-mm-yy' });
$( "#edit-submitted-enddate" ).datepicker({ dateFormat: 'dd-mm-yy' });

$('#edit-submitted-enddate').change(function() {
var start = $('#edit-submitted-startdate').datepicker('getDate');
var end   = $('#edit-submitted-enddate').datepicker('getDate');

if (start<end) {
var days   = (end - start)/1000/60/60/24;
$('#edit-submitted-days').val(days);
}
else {
alert ("You cant come back before you have been!");
$('#edit-submitted-startdate').val("");
$('#edit-submitted-enddate').val("");
$('#edit-submitted-days').val("");
}
});
});
});

But it doesn't work. Can you help me finding the error? It seems I didn't write it well on Drupal as js rule.

This is the javascript code that I want to write:

<script src="https://code.jquery.com/jquery-1.8.3.js"></script>
<script src="https://code.jquery.com/ui/1.10.0/jquery-ui.js"></script>
<link rel="stylesheet"             href="http://code.jquery.com/ui/1.10.3/themes/redmond/jquery-ui.css" />
<script>
$(document).ready(function() {

$( "#startdate,#enddate" ).datepicker({
changeMonth: true,
changeYear: true,
firstDay: 1,
dateFormat: 'dd/mm/yy',
})

$( "#startdate" ).datepicker({ dateFormat: 'dd-mm-yy' });
$( "#enddate" ).datepicker({ dateFormat: 'dd-mm-yy' });

$('#enddate').change(function() {
var start = $('#startdate').datepicker('getDate');
var end   = $('#enddate').datepicker('getDate');

if (start<end) {
var days   = (end - start)/1000/60/60/24;
$('#days').val(days);
}
else {
alert ("You cant come back before you have been!");
$('#startdate').val("");
$('#enddate').val("");
$('#days').val("");
}
});
});
</script>


texts: How do I increase the length of a text-field with saved values?

texts:
I have a multi-value text-field, projects. Its length is 4, and I would like to increase it to 255, but there are values saved in the database for that field.

How can I increase its length?


texts: How can I prevent placeholders to wrap the value with single quotes in db_query?

texts:
I want to run a select query using db_query. Here is the code:

$nid_array = array(24,34,56,7,8);
$list_of_nids = implode(',',$nid_array);
$query = "  SELECT *
            FROM {table_name} as t
            WHERE t.nid IN (:list_of_nids)";
$placeholders = array();
$placeholders[':list_of_nids'] = $list_of_nids;

$result = db_query($query, $placeholders)->fetchAll();

This query does not return any results.
Although if I do not use placeholders & replace :list_of_nids with $list_of_nids, then I get proper results.

I believe that when using placeholders the value of :list_of_nids is taken as the $list_of_nids wrapped with single quote, which is causing problem here.

I want to use placeholders. So, how can use it without wrapping the value with single quotes.


texts:
I'm trying to add:

drupal_add_js('jQuery(document).ready(function () { jQuery("input#edit-name").focus(); });', 'inline');

to the user login page when the user is not logged in. This lack of login form focus is one of my worst web annoyances.

What would be the most efficient way to do this?

I can add the code to every page by adding it to my theme's js, but this is inefficient.

In the theme's template.php I can use theme_preprocess_page() and check for $variables['logged_in'] but how do I test for only the /user page?


texts: How to add flat rate in Drupal Commerce?

texts:
I have installed the following modules in an existing Drupal site:

Commerce and Commerce UI
Customer and Customer UI
Price
Line Item and Line Item UI
Order and Order UI
Checkout, Payment, Product
Product Reference
Cart and Product Pricing
Tax
Product UI
Tax UI
Payment UI
Shipping
Shipping Flat Rate

And my online shopping is working fine as expected. Now I'm trying to setup different shipping rates, so I'm following the instructions on Flat Rate module, however when I go to Store > Configuration > Shipping there is no option to Add a flat rate service

Wha am I missing?


texts: No "body" when creating a node programatically, with Internationalization

texts:
I am trying to create event type nodes in Drupal 7, using data from an external database.
It's reading correctly, and creating a node almost perfectly.
But, it doesn't seem to save the "body" part of the node.

db_set_active('default');

foreach ($results as $record) { // Results gained from an ext DB
  echo 'Creating event: ' . $record->name;

  $node = new stdClass();
  $node->type = 'event';
  node_object_prepare($node);

  $node->title    = $record->name;
  $node->language = "en";;

  $node->body[$node->language][0]['value']   = $record->bodytext;  /* This line ?? */

  $path = 'content/programmatically_created_node_' . date('YmdHis');
  $node->path = array('alias' => $path);

  node_save($node);
}

This is early stages, and I have a number of fields to put into events type nodes, including some custom fields.

I am unsure how to map the fields in the external database to node fields.  The line above might be completely wrong at this stage, but it's gone though many many failing iterations.

As requested: DPM output of the node (after save)

... (Object) stdClass
type (String, 5 characters ) event
uid (String, 2 characters ) 10
status (Integer) 1
promote (Integer) 0
sticky (Integer) 0
created (Integer) 1357635638
revision (Boolean) FALSE
comment (String, 1 characters ) 1
language (String, 3 characters ) und
menu (Array, 13 elements)
title (String, 42 characters ) Starter Course
field_pakp_p1_id (String, 36 characters ) 78ee9b05-9225-fb5b-9bbb-508eada6ba81
body (Array, 1 element)
  en (Array, 1 element)
    0 (Array, 3 elements)
      value (String, 19 characters ) This is a body text
      summary (String, 19 characters ) Here goes a summary
      format (String, 13 characters ) filtered_html
path (Array, 1 element)
validated (Boolean) TRUE
changed (Integer) 1357635638
timestamp (Integer) 1357635638
publish_on (Integer) 0
unpublish_on (Integer) 0
log (String, 0 characters )
nid (String, 3 characters ) 423
tnid (Integer) 0
translate (Integer) 0
vid (String, 3 characters ) 423
field_event_status (Array, 1 element)
xmlsitemap (Array, 15 elements)

...

I also tried using the drupal_form_submit method..

foreach ($results as $record) { // Results gained from an ext DB
    echo 'Creating event: ' . $record->name;
    $node = (object) array(
      'type' => 'event',
      'language' => LANGUAGE_NONE
    );
    node_object_prepare($node);

    $form_state = array();
    $form_state['values']['language'] = "en";
    $form_state['values']['title'] = $record->name;
    $form_state['values']['description']['value'] = "description....";
    $form_state['values']['body']['value'] = "body....";
    $form_state['values']['body']['format'] = filter_default_format();
    $form_state['values']['body']['LANGUAGE'] = "en";
    $form_state['values']['name'] = $user->name;
    $form_state['values']['op'] = t('Save');

    drupal_form_submit("{$node->type}_node_form", $form_state, $node);

}

But again, try as I might, using this method I could not get the "body" to be saved.  (I know there is some junk in this code, it's my experimentation.)

Questions.

Which is the best method to use for my application.  node_save or drupal_form_submit
For the correct method, which is the best way to store the body text?
How do I know what are valid $form_state array keys, or $node elements, so I can find the correct place for further field mapping?


texts: Themes all deactivating at irregular interval

texts:
I recently updated my website from 7.22 to 7.33.

I have a problem with my templates randomly getting disabled.

I have 3 themes : desktop / mobile / corpo.

My URLs are has follow :
www.mywebsite.com -> desktop / mobile (module mobile switcher)
www.mywebsite.com/corpo -> corpo

They both point to different databases, via settings.php places in the following folders:
/sites/mywebsite.com
/sites/mywebsite.com.corpo

The corpo theme stays activated.

The 2 others often get deactivated (I tried clearing the cache, before anyone suggests that :) ). If I want to reactivate them, I click on "Enable" .

If I click on "enable and set as default", it's the default Garland theme that gets set.

Let me know if I can provide more info on this!

Thanks,


texts: Implementing hidden content parts (as in old "Hidden Content" module)

texts:
There is (long unsupported) "Hidden Content" module, allowing to insert content blocks visible by certain roles only, i.e. like below:
[hidden role="Role Name"]
   ...content visible to "Role Name" role only
[/hidden]

I browsed through related modules (from "Content Access Control" etc), but see no good match for this module's capabilities. Are there any simple means to achieve the above without either re-implementing the module for Drupal 9 or using inline PHP?
"Paragraphs Access Control" looks somewhat suitable, but it requires creating quite a complex structure only to restrict access to text blocks.


texts: Add a "autocomplete" field in a buildForm

texts:
How do I add an autocomplete field in a class that extends FormBase?

I created a custom module, which uses a class that extends FormBase. I want to  programmatically create a form field that autocompletes the username from the user registered in the site.


texts: DRUPAL_CACHE_PER_PAGE on a block creates cache records for every image style on page.. Totally ruins cache. [Fixed: Happens when images are missing]

texts:
I'm leaving this here in case someone searches.. These images weren't on my dev but when I copied them over, the cache stopped getting polluted. Woohoo.

When I enable DRUPAL_CACHE_PER_PAGE, my cache is getting polluted by dozens of almost duplicate records of the block, but with cids like the following.

custom_home_panes:custom_home_panes_news_group:framework:en:u.7094:http://270717.dd:8083/sites/default/files/styles/panopoly_image_full/public/badges/reading-girl-copy.png?itok=vPf92p1v

If you scroll right, you'll see the image, reading-girl-copy.png, is one of about 60 images on the page and it's in a different block that I'm not even caching yet.

Inside the blob for each of these records, the pager for the block I'm caching inexplicably takes on the href of these various images on the page..

1 of 3

next ›

The below record is the only one I want for this block.. It's per user per page.

custom_home_panes:custom_home_panes_news_group:framework:en:u.7094:http://270717.dd:8083/node/2435

I can only pursue an extreme cache clearing policy if the cache isn't polluted so any help would be great. I'm at a total loss as to why this would happen.

Thanks.


texts: Path is not available in Views filter criteria

texts:
I am creating a views with for node having fields Title,Author,Created,Path(page url). Now how can I add exposed filter for path(page url) so that user can find the specific page content in list.

Once I try to add Path in filter criteria it not visible it only available in fields section.


texts: How to add a title text input to an image field node form widget

texts:
If you have an image field widget in a Drupal node form you can automatically edit the image alt text in there, but is it also possible to add a title text field?

When I install the File Entity module I can add title text to images by editing them from admin/content/files but it doesn't make sense to tell clients to use this admin page to finish authoring their content.

Just to be clear, I don't want to have to make every image into a node, I just want to add form input fields to the image field widget so that the file entities can get a title text in the node form.


texts:
I'm trying to understand the flow of the bootstrap subtheme. The subtheme on my site was originally installed by a developer. I have since edited the css file to my liking and made adjustments to the bootstrap_subtheme.info, header.tpl.php, page.tpl.php, template.php and others.

The thing I don't understand is how to update the subtheme or even if I have to. I have been told by a developer that the bootstrap files are 5 years old. I apply each update as it comes into the list of updates and it is up to date in that respect. Do I have to update the subtheme manually from the basetheme? How do I find out the age/version of the subtheme?


texts:
I am not sure which change has make this error appear. I have updated from Drupal 7.2 to 7.56. Due to this I had to:

Modify the htaccess with the proposed code.
Also fix "The following module is missing from the file system ..." link

What I am trying to do is access Configuration or Reports. When I click on them the following message appears.

You have chosen to open:
Reports
that is: application/x-httpd-php(389KB)
from: http://ww.mydomain.org
What should Firefox do?


texts: How to add an extra form action on the user login page?

texts:
I would like to add a link to the user registration page on the user login page. As I want the link to be placed right next to the Login button, I thought that adding an extra form action would be the easiest way to do this.

Should I add/edit some template or is there a hook for this?


texts: custom HTML in search form ( site/search)

texts:
I'm trying to customize the html of the search block form.
I know that I can use templates.php to modifiy the fields and customize it but I'm trying here to change the whole html block.
I've tried to use search-form-block.tpl.php, but it didn't work (yes I've cleared cache).

I guess I'm missing something here ...

Any help appreciated thanks !

Ps : I'm using solr in an acquia environment.


texts:
I I'm trying to filter my view by a date filter in Drupal 8. I have a content type with a date field (without time).

I have a a range filter. When I filter >= 01-12-2017 (dd-mm-yyyy) till <= 31-12-2017. Agenda items on 30 nov will show.

When I filter on >= 01-11-2017 and <= 30-11-2017 these agenda items won't show? Any idea what is going wrong. It looks like there is a day difference...or the equal to options is not working.

Any idea what to dot with this problem?


texts:
I have a file attached to a node via a link. The node is published but the file is unpublished. The link on the node points to the file /sites/default/files/file.txt

The file is still downloadable by anonymous users.

I would assume the file, being unpublished, would be unavailable to download. This is not the case.

The anonymous permissions are set to view published content.

Is this expected behaviour? What would be the best way to not allow the file to be downloaded once it's unpublished?


texts: get same result from db_query() as views query

texts:
I know I can get a views result programatically with:

$view = views_get_view('view_name');
$view->execute();
$response1 = $view->result;

I can get this views sql query from the views ui (views->settings->show sql).  If I place this query in a db_query() and get the results with:

$query = "... "; //long sql query from views ui (in my case with left_joins which reference field collections
$result = db_query($query);
$response2 = $result->fetchAll();  //different than $response1 above?

the responses returned from $response1 (from views) and $response2 (from db_query) are different, namely, the $response2 doesn't contain my field data (or at least not all of it).  I'm not sure if this has anything to do with the fact that I'm using field collections.  It also seems to not work when using the different fetch() functions.   If I run this query through phpmyadmin it produces the same limited results as $response2 (from db_query) so I'm wondering if views runs something aside from the query.  I'd like to find out what the method result() does for the views object, but I'm not sure where that is in the docs or where the function is in my views source.  If someone can show me where that is, that would also be helpful.


texts: I have a field collection named rmr_bar_li. I want to add a div to each line item of field collection, that is within field collection. How can I do that? Can any one help?


texts: When a user selects french they are redirected to /fr, using the Drupal translation module. Is there anyway to make this selection persistent or "sticky", so when they return to the page it is the same language they selected?


texts: Breadcrumb Path Disappearing (temporarily) after Cron

texts:
This is a problem that's been bugging me for a while. I am using a book structure to generate my breadcrumbs, but it seems that when I first load a page, only the homepage and title of the page itself loads in the breadcrumbs. However, once I refresh the page the rest of the path will show up.

See this image for an example of what I'm talking about:

The breadcrumb trail on the top is the initial page load, and the one underneath it is when the page has been viewed at least once.

It seems that the paths all get reset whenever the cron is run. What exactly is going on?


texts: Adding custom field to apache solr drupal 7

texts:
I have tried Apache Solr Autocomplete to make autocomplete option in solr search. But it is not work for me. Is there any other alternative to do this?

And also I need to know, how to add custom field to be indexed in solr. I have tried hook_apachesolr_index_document_build_node and my_module_apachesolr_query_prepare in my custom module. But when I put this the index is not added to solr.`

Any suggestions?


texts: How to alter view query after exposed filter is changed?

texts:
We have a custom view, myview, that has two exposed filters: country and category. For the country value we have a value that we want to be applied regardless of what is selected as the exposed filter that is not All Countries.

How would we alter the query after a value is selected so that we always append an or country = United States of America to whatever value is selected for the view's query?

Goal:

After the exposed filter has been applied, alter the query such that it will return whatever the user selected AND all other nodes where country = 'United States'.

Country value:

All Countries
Worldwide
United States of America
United Kingdom
France
Germany

What we were thinking of using hook_views_query_alter, but not sure how we can alter the query after a value has been selected.

mymodule.module

use Drupal\views\ViewExecutable;
use Drupal\views\Plugin\views\query\QueryPluginBase;

/**
 * Implements hook_views_query_alter().
 */
function mymodule_views_query_alter(ViewExecutable $view, QueryPluginBase $query) {

  if ($view->id() == 'myview') {
    $or_statement = new Condition('OR');
    $or_statement->condition('field_country', '12', '=');
    $query->addWhere(0, $or_statement);
  }

}

Current filters:

published = yes
content type = article
country (exposed filter, display all, single select)
category (exposed filter, display all, single select)

When using ksm() to print the $condition_group, this is the results. It is not even showing the two exposed filters.

Current Where Clause

10 is the value selected by the user from the exposed filter and 12 is the one we want to add.

WHERE (((node__field_country.field_country_target_id = '10')) AND (node__field_country.field_country_target_id = '12'))

Desired where clause

WHERE (((node__field_country.field_country_target_id = '10')) OR (node__field_country.field_country_target_id = '12'))


texts:
I'm creating a custom importer with migrate from json files.
I've several migrate sources for nodes (called: articoli, canti, autori) and one source for comments (called: commenti).

I'm using migration plugin to set relationship between entities, but in the yml for comment how should I set multiples sources?

In documentation I find this:

 process:
   uid:
     plugin: migration
     migration:
       - users
       - members
     source_ids:
       users:
         - author
       members:
         - author

I don't understand if migrate cycles for every migration (users, members) using these source_ids and, if matches, goes to next element.


texts: Drupal message(on view node) is shown even after form submission

texts:
I want to show a drupal message on all the nodes of blog type:

I have the following rule:

{ "rules_show_message_on_blogs" : {
    "LABEL" : "Show message on blogs",
    "PLUGIN" : "reaction rule",
    "REQUIRES" : [ "rules", "workflow_rules" ],
    "ON" : [ "node_view" ],
    "IF" : [
      { "node_is_of_type" : {
          "node" : [ "node" ],
          "type" : { "value" : { "blog" : "blog" } }
        }
      },
      { "data_is" : { "data" : [ "view-mode" ], "value" : "full" } }
    ],
    "DO" : [
      { "drupal_message" : {
          "message" : "This is a feature",
          "type" : "warning",
          "repeat" : 0
        }
      }
    ]
  }
}

I also have a search form on all the pages of the site. The problem is that the message is also shown after submitting the search form.

Any help would be highly appreciated?


texts: Add a single image field to a view (not its nodes, the view itself)

texts:
I would like to know if it is possible to have an image field in the setup of a view, that I could then display in front-end, on top of the view via the views-view template.

So far, I can only find topics about how to add an image field to nodes of the view. I want this image field to be related to the view, just like the "view title" field.


texts:
I have a strange problem... I just uploaded our new Drupal site. Everything looks great - until we enabled SSL. When SSL is enabled, the look-and-feel of the sight changes slightly. The fonts change in a few places and the width is off on the main pane. It's as if something in CSS is getting messed up. But I can see that the CSS files are being loaded.

I disabled caching and Page Speed, thinking perhaps that was the issue.. but disabling that didn't fix the problem.

I'm really at a loss here. Does anyone have any suggestions on how to tackle this issue?

I'm running Drupal 7.24 on an Apache web server.

Thanks!


texts: Using Caption Filter Module with Media Module 2.x

texts:
I'm seeking a good method for non-technically savvy users to easily caption images. Caption Filter seems an excellent method to achieve this, however, even though this article says it is compatible with Media 2.x, it doesn't seem to be.

Does anyone have experience with using this module that could fill me in on how to use them together?

Alternatively, if anyone knows how to get Media 2.x to insert the actual <img> tag in the WYSIWYG, rather than the bracketed content, that would solve the problem as well.


texts: Views exposed Filter by date: month OR year

texts: If i make an exposed filter with a date-field, i can only select date and month together. Not on year or month. How can i make it by year OR month?


texts: Back-office in English / Front office in other language

texts:
Is this possible the have the back-office of a drupal 8 website in English (for exemple) and the front office in one other language only ?

I don't want my front office to be multilingual (with /fr or /en, only /).

Cheers,


texts: How do priorities work in the *.services.yml YAML file?

texts:
In system.services.yml and many other services files, one can find priorities like this:

services:

  ...

  path_processor.files:
    class: Drupal\system\PathProcessor\PathProcessorFiles
    tags:
      - { name: path_processor_inbound, priority: 200 }

  ...

Are these priorities similar to the weight-system we know from Drupal 7, where a low weight means earlier in the processing order. Or do priorities work the other way around, where the items with the highest priority are processed first?

I am asking because I could not find a source explaining this.


texts: URL alias not working in Contextual filters using node reference field

texts: I have a node reference field in views contextual filter and need to filter the list of contents. Url path in views like "node/%/foo " working for me, but the node alias like "/alias/foo" not returning any results . Anyone please suggest for this.


texts: How to make panels with a node reference argument

texts:
I have a multi-user site. When a new user registers, several nodes (such as gallery node, etc.) are automatically created for him/her.

There is a panel page for each user that displays a profile of its owner. The panel is composed of various view panes.

Very much like in other community sites, a visitor to the profile page will be able to leave comments (text + pictures.)

To that effect, and hoping this is the right approach, I am trying to include in the panel a comment form. Comment forms are attached to their respective nodes so that comments left on John's panel page do not show on Jack's panel page. Comments will be displayed under the form in a view. The view is obviously universal and the same for all panel pages.

Now, on to the comment form. There is a node, specially for comments, created at the time the user registers.

How do I include the comment form of that node in a panel context knowing that it has to be different for each user?

I see that a node context can be passed into the panel. However, it requires a node ID. So that limits it to one node.  Does it support some kind of token so that a different node ID loads on different users pages? If so, how would I write it?

If i am using the wrong approach on this, how should I go about it?

Any idea anyone?

Thank you. :)


texts:
I want to import data from excel to created view how can I do this? using what module I can achieve? I found some user import tutorial but in views how to import the data?

Your suggestions are valuable thank you.


texts:
I have a Drupal 7 website that is intend to be fed by a JSON file.
This file, is actually processed and updated by a ETL tool that runs periodically (each 3 hours by example).

Once my ETL tool has processed the output JSON file, I need a way to tell the Drupal Feeds module to start the import.

Is it possible ? Or do I need to do this with CRON ?

Ideally, this job would be trigged by a specific URL call (just like the CRON can be called manually by visiting a specific url).


texts: Clone product display with referenced product

texts:
I am using Commerce Kickstart for Drupal 7, and I need to be able to clone products.

In Commerce Kickstart you have all the products just as "reference" of node, product display. I mean, the products themselves are displayed for customers similar like any other page, with "attached" actual products. (this allows you to create more variations of one type)

I am trying to clone both of those by one operation - to clone Product display (as node), and also referenced product by this product display. But when I used basic Node Clone module, it just clones Product display as a node but not the reference. Result is, the same cloned content with "attached" reference product at the very bottom, but when I change that product, It also changes the product of previously cloned product display.

Here is what I mean: http://harmonel.sk/stuff/drupal_commerce.jpg

I am not sure what to do, I am not very good with coding, maybe I should somehow re-write the Node Clone module to also clone the referenced product? Does anyone had similar or same problem? I am trying to achieve this with Rules but with no success, but maybe that would be the best way to achieve this?

Any advice would be greatly appreciated.


texts: Commerce: programmatically create new product with my ID

texts:
I have database of products and I want to export it to Drupal Commerce database with my Ids being saved:

$product = commerce_product_new('product');
$product->product_id = '100500';
$product->title = 'my title';
commerce_product_save($product);

But it always returns STATUS_UPDATE because in sites/all/modules/commerce/modules/product/includes/commerce_product.controller.inc in line 80 there is:

// Determine if we will be inserting a new product.
$product->is_new = empty($product->product_id);

It always clears "is_new" when "product_id" is filled.

If I change that string like:

$product->is_new = !empty($product->is_new) || empty($product->product_id);

Everything works fine.

Is it a Commerce bug or I do something wrong?


texts: How to add the image url in the head tag

texts:
Do youknow how to add the image url to the head tag?

This is what I've tried so far

Example

<head>
     <meta property="og:image" content="  {{ file_create_url(node.field_image.0.entity.uri.value) }}        "/>
     <meta property="og:image:secure_url" content="  {{  file_create_url(node.field_image.0.entity.uri.value)  }} " />
</head>

Thanks!


texts: Number of users currently checking a node

texts:
I need to build a view "preferably a nodejs_view" that could count the number of logged in users that are currently checking a node.

Lets say we have 10 users currently checking node/123, I need to create a view that shows something like this:

node: 123
viewers: 10

node:124
viewers: 2

Is there any modules that could provide that? any idea how to build such thing?


texts: How can I trigger rerender of an element in a preprocess function?

texts:
Update: My current solution is to use the Field formatter conditions module, to suppress output of the fullname field when a first name is present.  It seems like it should be very simple to replace the value of the fullname field with the contents of the two name fields and hide those fields, but my node.tpl.php file seems not to do anything now that I'm using display suite and I can't figure out how to accomplish what I want in template.php.  Some help with that would still be greatly appreciated.

Note: I would like not to create a module just for the purposes of wrangling a couple of fields.  I am still looking for an answer to this, or a solid explanation of why a module is definitely the right way to go.

I'm probably taking the wrong approach to this.  With everything I try to do, I seem to try every wrong way first before throwing up my hands and asking the internet to tell me the right way, and invariably the right way feels wrong.

Today, I'm trying to replace the value of one field in a paragraphs bundle item with the values of two others. Here is the relevant code from template.php:

function enviroscope_preprocess_paragraphs_items(&$variables, $hook) {
    $element = &$variables['element'];
    foreach ($element['#items'] as $delta => $item) {
        if ($element[$delta]['entity']['paragraphs_item'][$item['value']]['#bundle'] == 'doc_other_contrib_pb') {
            $person = &$element[$delta]['entity']['paragraphs_item'][$item['value']];
            if (isset($person['field_pb_doc_other_first_name']) && isset($person['field_pb_doc_other_family_name'])) {
                $person['field_pb_doc_other_fullname'][0]['#markup'] = $person['field_pb_doc_other_first_name'][0]['#markup'] . ' ' . mb_strtoupper($person['field_pb_doc_other_family_name'][0]['#markup']);
            }
        }
    }
}

I verified that the #markup element of the fullname field is updated, but everything still shows up the same. Is there anything I can do to rerender?


texts: 'Entity Reference to taxonomy' Field in chosen format is not allowing to add new terms?

texts:
I Installed Chosen module and I have created field referencing to a taxonomy in one of my content type. But this is not taking the newly entered term, though i checked 'create new term if not exist' in manage field settings as shown in below image:

Or Any idea How to remove tid from autocomplete selection.Same question is already asked before like in link1 ,link2, but i didnt get proper solution.


texts: I have a field which looks corrupted. How should I remove all traces of it?

texts:
Problem

I have a taxonomy field that I was forced to re-create with different values after a number of errors. (I deleted the field and taxonomy and re-created them.)

It's used as an exposed filter in views and unfortunately appears to have become corrupted. Whenever I use it as a filter, in the drop down it only shows the previous values of the field (before it was re-created).

Clearing the cache, re-creating the field, clearing the search indexes, creating new views have all had no effect. Other identical field names with different machine names work fine so I'm presuming it's corrupted.

How should I go about cleaning this field from my database?

I'm considering just re-making it under a different name but I'm worried about the consequences of leaving some corruption in my database.


texts:
I'm having issues customizing a radio button for a specific form using hook_theme.  Below is the piece of code I have on my module; see my comments elaborating the issue I encounter:

// Implementation of hook_form_alter().
function mymodule_form_alter(&$form, $form_state, $form_id){
  // e.g form id: commerce_cart_add_to_cart_form_u6onPJSgS7pOgw0Tlo7zHy42LTQzbV913taANkYQKTo
  if (strpos($form_id, 'commerce_cart_add_to_cart_form') !== FALSE) {
    // Alter add to cart form
    mymodule_commerce_cart_add_to_cart_form_alter($form, $form_state, $form_id);
  }
}

function mymodule_commerce_cart_add_to_cart_form_alter(&$form, $form_state, $form_id) {
  // Change the field type to radios.
  $form['attributes']['field_artwork_ref']['#type'] = 'radios';
  // Apply my custom theme for radios.
  $form['attributes']['field_artwork_ref']['#theme'] = array('custom_radios');
}

// Implementation of hook_theme().
function mymodule_theme() {
  return array(
    'custom_radios' => array(
      'variables' => array('element' => NULL),
    ),
  );
}

function theme_custom_radios($variables) {
  // Custom theme should go here.
  // However, $variables are empty, print_r gives me "Array ( [element] => )."
  // I am at least expecting to see my radio element here.
  print_r($variables);
}


texts:
My page has details from two content types.

Product Line, a vendor dealing with different products having its attributes
Document Library Item, a common content type for files like images or brochure which are related to the product line

I need a view displaying all the filenames which could be filtered by product line. This was achieved with a view; to increase performance, we planned to integrate it with Solr.
I indexed both the content types with Apache Solr and displayed the result in the view, but I am getting comma-separated values.

I understand the result is grouped from Solr, but I need to display the filename as separated record, instead of comma separated.
Is there any option to configure this in Solr or a way to alter the view result?


texts: Views Related Items Block when Taxonomy term is not on URL

texts:
I have a "Views Related Items Block" problem which I thought was simple but have stopped me dead in my tracks for the last 2 weeks. I have Googled lots and lots of "Drupal Views Related" to no avail and hope someone will be kind enough to help me out.

Here is a sample content node:

TITLE: ABC123 (simple text string)

SHAPE: Square (stored as a taxonomy vocabulary called "Shape" with possible terms of "Square / Circle / Triangle")

COLOR: Red (stored as a taxonomy vocabulary called "Color" with possible terms of "Red / Green / Blue")

I have successfully created a VIEW PAGE configured to display the details of a product item at the URL:

http://www.mysite.com/products/square/abc123

where "square" (as a taxonomy filter) is the shape of the node item and "abc123" is the title of the node.

I would like to create a related items block on this page that will display all items that have the same SHAPE AND COLOR as item "ABC123" (square and red in this case).

I've played with MANY different configurations of "Content: Has taxonomy term ID / Load default filter from node page, that's good for related taxonomy blocks". But it seems like I can only successfully filter for "shape" and not "color". I just don't seem to be able to extract "color" given the above URL path.

I am open to using PHP code filter or even pre_execute() SQL modification, but I have zero experience in doing that in Drupal.

Any help will be most appreciated!

Thanks.

Andrew


texts: how to preview a youtube video thumbnail when media is selected in a form?

texts:
I've created a form in which people can load a video from YouTube, DailyMotion or Viméo. I use the Media file selector widget.
When I chose a vimeo video, everything is ok, i can see the thumbnail of the video. But with YouTube and DailyMotion videos, I only see the default thumbnail icon...
How could I fix it?


texts: How to remove a Views row if field equals value?

texts:
In my view I have a made a customised global field that returns a boolean result.

What I now need to do is if this field equals zero then the whole row should be ignored/removed from the view.

The issue here is that I cannot see this field in Filter Criteria to add as a filter.  I have also looked into a programmatical solution but have looked at hook_views_post_render and hook_views_pre_render but cannot see how I can achieve this.

Any help, module suggestions or push in the right direction would be very much welcome.


texts: Splitting Drupal commerce order for easier shipping

texts:
During shipping we generally need to split the orders based on the availability of the products. Considering the order contains two products but only one product is available, we would like to split the order such that we can ship one product now and we can ship the the product later. Both split orders will contain same address and other details.

Are there any module that does this?


texts: Issues importing nodes containing taxonomy terms with &/& using feeds

texts:
I have a view that outputs XML either on screen (using Views Datasource) or a file (using Views Data Export), and I'm attempting to import the data generated by the view using the feeds module.

The view contains several taxonomies, some of which contain terms with an ampersand (e.g. "Finance & administration).

The datasource view outputs the term without encoding these ampersands "&", while the views data export seems to encode them regardless of the setting in the view to do it or not. (The value stored in the dB is "&", not "&amp".)

With the datasource feed import, it appears all nodes that have & in at least one term associated to the node are skipped. I say this because those nodes never even show up in the debug output (which sounds like a bug to me).

With the views data export XML file import, all the nodes are imported, but the taxonomies that accept multiple values never get set properly.

Using Feeds tamper, I have tried using html entity decode/encode, and attempted to use it before/after explode, but nothing seems to fix either issue. I believe I should focus on the XML file import since at least all nodes are being imported.

Any thoughts on what may be happening during the XML file import, and how to address the issue? All the modules are the latest stable version.


texts: place own block from module to the left of the screen

texts:
This is the first time i'm making a module for drupal.
In my module I create a block with a vertical menu in it.
I would like to place the block glued to the left of the screen (out the wrapper).

So far i tried to make my own region in the module (which worked) but I can't get the region to appear in the website. I know i would have to do this in the page.tpl.php from the theme, but I'm trying to do this through my module only.

So is there a way to make the website take the region?
Is there a other/better way to place the block to the left?

thanks in advance!
TL


texts:
I have a view of all content, of all types, listed by date order. Paginated of course (with load more).

I want to find the latest piece of content of type X, and promote it/make it stick to the first result.

I was initially just going to use an attachment, but this comes with 2 problems.

The item ideally won't repeat
If it is already the first item, or in the first few results, there will be 2 right next to each other.

The item should not persist as the first item on each page, it should just be moved/re-ordered.

I feel like this should be very straight forward, but I am drawing a blank.

Any help most appreciated!


texts: Why would a new user role have default permissions that are greyed out and cannot be changed?

texts:
I recently installed a new role for the LoginToBoggan module for pre-authentication, aptly named 'pre-authenticated.'

However, this user has has all the default permissions of an authenticated user, and even one that is not (Edit own comments).

If I hit 'edit permissions' to the right of the user role name on the roles page, I get the single column and can set them as desired.

However, when I look at the permissions column when all roles are listed, none of my configuration settings I had saved are honored. Also, they are greyed out and cannot be changed, giving this user permission to add and edit content. Even more of a problem, this role can indeed add and edit at will before being authenticated.

Thoughts on why this is happening and how to fix it?


texts: What do I do with the list of blocked IP addresses

texts: I have a growing list of blocked IP addresses on my Drupal 7 site. I've installed the following modules: Honeypot, Captcha questions, Captcha, reCaptcha, and Hidden Captcha. They all work fine and there are no more bogus users or posts created but there are still a lot of bots that try to intrude with scripts. Is there something I can do with the collected IP addresses from this path: admin/config/people/ip-blocking to help perhaps others or the community as well?


texts: How to update relative image paths on domain migration? (Incorrectly generates previous)

texts:
Problem

(Found the same problem recently, re-wrote question to be more general and useful)

I recently had to change the domain of my site.

On changing it I've found Drupal fails to update the domain of the URL in a lot of the images on my site.

So for example, I changed from domain1 to domain2:

The path for a background image in a CSS file would originally be:

background-image: url (https://domain1.com/sites/all/themes/tefltheme/images/empty1.gif)

After changing the domain it would remain:

background-image: url (https://domain1.com/sites/all/themes/tefltheme/images/empty1.gif)

Nothing I do seems to cause this to re-generate. Has anyone else run into this? Where is Drupal storing this information?

What I've done

Clear caches
Flush memcache, varnish and drupal
Wipe all Advagg files and re-generate
Set the base URL in settings.php

On the back-end it recognises my URL has changed for example /admin/config/system/site-information shows domain2 in all the prefixes.

(I can fix this by putting an exact path in all my CSS etc, but obviously I'd prefer to avoid this.)


texts: Reinstall a patch with composer - update one module only

texts: Can I update a patch without running composer update ? In other words: can I update one module only?


texts: I'm formatting articles with Ckeditor. This works fine in Drupal 7 but when I try to share the link in Facebook the special characters appear on Facebook. Is there a way to avoid this ?


texts: How do I programmatically implement account lockout after 5 invalid login attempts?

texts:
I created a custom login form. I created a module for this, then a controller to show the form and login the user. I used the function user_login_finalize($user); to login the user.

So the question is, if the user entered an invalid password, how do I implement account lockout after 5 invalid login attempts?

I'm using Drupal 8.


texts:
Using Views I've created a block which show the immediate children of the current parent book page. What I really want is a block that shows the total child hierarchy of the current parent book page. My intention is to place these blocks on just certain pages which have no content but are there for content grouping. I'm on Drupal 9 if it matters.
This is the screenshot of the fields in the block view.

This is the screenshot showing the first advanced settings of the view.

This is the screenshot of the block rendered on one of my book pages.

Each of those headings have a hierarchy beneath them. I want to see the expanded tree rather than just the immediate child pages.
Is there a way to modify the view to show all children pages?


texts:
Running into a slight workflow problem, and finding out that a lot of us being new to Drupal doesn't help. =) Thank you in advance.

The issue being is that a lot of the front-end developers at my company are used to working locally with every project. But our new Drupal CMS I would like to only have running in one location, not on their local machine or our internal server, but only running on a remote server and installed once. We will have many running for our clients and I need to keep the code maintained properly, and would hate a front-end developer to work on it locally to only find out their version is behind now during the length of their project. Or worse yet, they are working on five projects at once and they have to maintain all of those on their machine.

We figured out a small hack to get CodeKit to work on their machine while still seeing the files on the server refresh, so SASS isn't an issue. But they are so used to working locally, they are having a hard time grasping theming on a remote server. I am very much used to working in larger applications that need several environments or complicated compiles, so using Drupal in one place seems SO easy to me.

How does everyone else work on themes? What does your workflows look like? What advice can you give? Anything will help!


texts: Drupal Rule to Clear a Field But Still Retain Data?

texts:
Need advice on fufilling this use case:

Use Case:

When User edits the node the first time, he populates Field A, a text area.  The data from Field A is eventually displayed on View A.

When User or other User returns to edit the same node, Field A is cleared for convenience, ready for new text input. (But the original data is still in the DB, and displayed in View A).

When the User saves the page this second time, the new data replaces the previous data in View A.

Plus: Eventually,  I also need to display the history of Field A in the application from all the saved edits.


texts: Add html to li for active-trail menu links

texts:
Ive used the theme override below to add a span to the end of the li of my menu links. This is working but I need it so the span is only added to the active-train li.

function MYTHEMENAME_menu_link(array $variables) {
  $element = $variables['element'];
  $sub_menu = '';

  if ($element['#below']) {
    $sub_menu = drupal_render($element['#below']);
  }
  $output = l($element['#title'], $element['#href'], $element['#localized_options']);
  return '
' . $output . $sub_menu . ' Something ' . "
\n";
}


texts: Custom VBO action fails silently / works with AJAX error in Views Admin

texts:
Here is an action I need to use with VBO:

/*
 * Implements hook_action_info()
 */
function ams_action_info() {
  $action = array(
    'ams_archive_action' => array(
      'type' => 'ams_survey',
      'label' => t('Archive survey'),
      'configurable' => FALSE,
      'triggers' => array('any'),
//      'behavior' => array('changes_property')
    )
  );
  return $action;
}

/*
 * Implements a registered drupal action to set the archive bit on given survey
 */
function ams_archive_action(&$entity, $context = array()) {

  drupal_set_message(print_r($entity, TRUE));
  $entity->archive = 1;
  entity_save('ams_survey', $entity);
}

I selected the action in the list for a Bulk Operations field in a table view for my custom entities 'ams_survey'. The view and operations form look fine but executing the action just reloads the page. If I execute in the preview in view builder admin, I get an error popup starting with "An AJAX HTTP error occurred." but the action is successfully performed.

A block display for this view is being loaded and displayed inside a form callback which is being loaded in a page callback from hook_menu(). I have tried turning off AJAX and turning off views cache with the same result.


texts: View content based on if a new session is created

texts:
I am running a Drupal 7 website using the Ubercart module. I am trying to show some HTML content when users get on the site, and not keep viewing it when they click on a certain button. I need this piece of content to appear at the top of the website so I tried putting it in the HTML in the page.tpl.php file, which works, but then it keeps appearing every time the user goes to a different page or reloads the page. The way I am thinking of approaching this is as follows:

1) A new session is created when a user lands on the site.

2) If a new session is created, I will copy that session's value into another variable ($variable = session_id();), and execute some code when the content of $variable is equal to the value returned from session_id().

3) I will have that piece of content as a <form method="POST">. When the user clicks on the close button, that will $variable = $variable + 1;.

4) This way the if statement will be FALSE for this session and the content won't appear anymore.

my problem is with knowing if a NEW session has been created or not. I have tried using if (drupal_session_started()) { echo "s";} ?> but that doesn't print anything which means I still can not check for new sessions started. Shortly, I need a way to know if a new session has been started on the site, so I can do the mentioned steps. Bonus if you tell me what you think about how I'm going about doing this, because I'm a Drupal newbie and there might be easier solutions.


texts: Add custom html to a facet api facet block

texts: How can i add custom html to a facet api facet block. Like a link to another page or some descriptive text and an image. It would be good for user experience.


texts: How to show a Drupal Commerce coupon system on the cart page?

texts: I am new in Drupal and working over a shopping site using Drupal Commerce. My client's requirement is that to show a coupon field in the cart page through which user can add a coupon code. I have installed the Commerce Coupon module, but did not understand how to show the coupon form on the cart page.


texts: Adding a "three line" character (☰) or image to TB Mega Menu dropdown button

texts: I'm currently developing a website with TB Mega Menu using a Zen subtheme. The problem is that the default TB Mega Menu button (the one that replaces the 'normal' horizontal menu on smaller screens) is just an empty white button without any signs. I want to make it more understandable for users by adding an industry-standart "three line" character (☰) or an image. Does anyone know how this can be done?


texts: How can i get the entity id in my custom form/field?

texts:
i have a problem about get the entity_id in my customfield.module

i know how to get the [width] field value in my program by using the code $item['width'],

but are there any function that i can use to get the entity-id and entity-type='node'?

another question: when i initial a form in my customfield.module,the same problem ,are there

any method that i can use to get the current entity id ?

Thx a lot ~


texts: Add a last edited by column to find content results

texts:
In the admin area when a user is on the find content page /admin/content I would like to add an extra column to the results table to display the user who last edited the node.

I'm fine with actually querying to get the data I'm just not sure of the best way to add the extra column to the results table.

Thanks


texts:
I can use the UI to create a new view mode for a comment type in Drupal 8, without problems, but I don't see how to use that view mode.

For example, I just want to have a teaser that shows only the first few lines of each comment, and not the comments on this comment.

How do I specify a particular view mode should be used for the comments on a particular content type?

Does this require Display Suite?


texts: Get the username of a user who is being added to an organic group

texts:
We're using organic groups, and we'd like to notify an administrator every time someone joins a group.

At the moment, we've set up a trigger for this, and set up an action to send an email. We're using the %username token in the email, but this refers to the username of the person who created the group in the first place, not the username of the person joining.

Is there any way to send an email that includes the username of the person who is joining the group?


texts: How can I bulk add existing commerce products to a display node?

texts: pretty simple, i want the ability to add more than one existing product at a time to a node. i am already using bulk product creation to help me create all the variations of the product quickly. but then after that, i have to add them 1 by 1 to the display node. i would love the ability to just add a product range by product ID or something.


texts: How to disable sortable headers in Admin theme tables

texts:
I'm outputting some data from a custom module as follows

theme('table', array('rows' => $rows, 'header' => $headers ));

to a custom /admin page that will be viewed using the Administrative theme.

Problem is that the headers are generated as (a) clickable and (b) the selected columns have up/down sort arrows. But when you click on the arrows, no sorting happens.

How can I either remove this styling from the header, or implement a sort for the table?


texts: I can't uninstall modules with Drush master-branch and almost no data on Google

texts:
When navigating to my sites' folder and typing drush pmu admin_menu or otherwise drush pm-uninstall admin_menu in drush master branch I get:

  Command pm-uninstall needs a higher bootstrap level to run - you will
  need to invoke drush from a more functional Drupal environment to run
  this command.

I found only 3 discussions in Google, touching this in relation to Drupal 7 (dev or fresh).

I should note that another command, drush cr (cache-rebuild) works
just fine.

Drush status:

C:\wamp\www\sname>drush status
 Drupal version         :  8.0.0
 Site URI               :  http://default
 Database driver        :  mysql
 Database hostname      :  localhost
 Database port          :  3306
 Database username      :  sname
 Database name          :  sname
 PHP executable         :  php.exe
 PHP configuration      :  C:\wamp\bin\php\php5.5.12\php.ini
 PHP OS                 :  WINNT
 Drush script           :  C:\drush-master\drush.php
 Drush version          :  8.1-dev
 Drush temp directory   :  C:\Users\Beni\AppData\Local\Temp
 Drush configuration    :
 Drush alias files      :
 Drupal root            :  C:\wamp\www\sname
 Site path              :  sites/default
 Sync config path       :  sites/default/files/config_mkuaR5uFQ7VCjh1_FFBuZzWXkUsz-sA7Klv4HO_2yLJG33wfJJabdavO7QKzyIRWiQoWA3IJbg/sync

C:\wamp\www\sname>

Drush sql-conf

C:\wamp\www\sname>drush sql-conf
Array
(
[database] => sname
[username] => sname
[prefix] => Array
    (
        [default] =>
    )

[host] => localhost
[port] => 3306
[namespace] => Drupal\Core\Database\Driver\mysql
[driver] => mysql


texts: How can I access the main menu in template_preprocess_page?

texts: I would like to assign the main menu of my site to a variable using template_preprocess_page() so that I can just use something like {{main_menu}} in the page template. Any ideas on how I would go about doing this, without having to assign the Menu to a Region?


texts: Acquia Dev Desktop create-project Fails With 404 Error at Repository

texts:
I am using a brand new installation of Acquia Dev Desktop on Windows 10.  When I try to use composer to create a new project I get the following output using the -vvv option:
composer create-project drupal/drupal-project:8.x    hhc  --no-interaction  --no-install  -vvv

Downloading https://packagist.phpcomposer.com/packages.json
[200] https://packagist.phpcomposer.com/packages.json
Writing C:/Users/JimD/AppData/Local/Composer/repo/https---packagist.phpcomposer.com/packages.json into cache
Downloading https://packagist.phpcomposer.com/p2/drupal/recommended-project.json
[404] https://packagist.phpcomposer.com/p2/drupal/recommended-project.json
[InvalidArgumentException]
Could not find package drupal/recommended-project with version 8.x.

This happens with both composer versions 1.10 and 2.0.7.
I have tried all of the following and got the same result after each.

composer clear-cache

upgrade from version 1.10.13 to 2.0.7

clear-cache and composer reloaded all the .json files from repository in to cache.

Uninstalled Acquia and removed all file folders related to composer.

Tried different --stability options

Tried installing project for other platform
composer create-project -n concrete5/composer dreamrs  --no-install  -vvv

Tried repositories https://repo.packagist.org and https://packagist.phpcomposer.com
In every case I get the "Could not find package" error.
EDITED:
Latest effort, I downloaded the recommended-project.json file, put it in an empty folder and ran composer install -vvv.  I got a 404 error for every package.  Here are some examples:
[404] https://packages.drupal.org/files/packages/8/p2/drupal/core-dev.json
[404] https://packages.drupal.org/files/packages/8/p2/drupal/core-composer-scaffold.json
Any idea what is going on here?  I can download other packges such as hirak/prestissimo and grasmash/composerize-drupal.


texts:
I'm having troubles migrating a Drupal 5 site. I don't have direct access to the original site, but I've been given the Drupal source files and a dump of the database.

When I upload the database to my local server and alter the settings file to connect to the database I can access the first page, but nothing else (eg: nothing within the admin area). When I click on any other link I get a generic HTML file with just one string of text in it. I can't even tell how the file is being generated, it's the oddest thing.

I'm really thrown off because I move Drupal 6 sites all the time, and although I do run into all sorts of problems related to file paths, a few search/replace queries in the database seem to fix most of those problems

So I'm wondering if there is something specific to Drupal 5 that I should be doing (but that I'm not aware of). Perhaps the database is corrupt?

I'm at a loss here!


texts: Write all PHP errors, warnings and notices to error_log

texts:
Drupal catches PHP warnings and notices to log them via dblog or syslog. As a result, there are two places to monitor for PHP errors (with the watchdog UI not well suited to cater for any large number of notices).

Is it possible to prevent this behavior and have ALL php errors be logged to the error_log defined in the php config?


texts: How to handle a Drupal core change that have an impact in the next release of a contrib module?

texts:
Reading the Drupal Changes records I found that drupal_get_message() and drupal_set_message() replaced by Messenger service so lets suppose that I have a module that use the drupal_get_message() function and I want to replace it with the new Messenger service. If I do it my module only will works starting from Drupal Core >= 8.5.

So, in this point what is the correct way to produce the next module release?

Should I restrict the next release to a specific Core version adding a comment in the release notes or should I create a new branch (lets says 8.x-2.x) to implement this changes and have two module versions like 8.x-1.x (working for Core < 8.5) and 8.x-2.x (working for Core >= 8.5)?


texts: Progress bar advances, operations does nothing

texts:
I'm trying to create a batch to import users. I used this (http://pastebin.com/duTbxpgd) as an example, but somehow it's not working. I see the progress bar advancing and It's showing the right number of rows I'm processing. But what I'm trying to do in the operation function isn't executed.

Here's my code:

function form_submit($form, &$form_state) {
  batch_import_users();
}

function batch_import_users() {
  db_set_active('mysqldb');

  $result = db_query("SELECT * FROM {users}");

  db_set_active('default');

  $batch = array(
    'title' => t('Importing users ...'),
    'operations' => array(),
    'init_message' => t('Commencing'),
    'progress_message' => t('Processed @current out of @total.'),
    'error_message' => t('An error occurred during processing'),
    'finished' => 'batch_import_users_finished',
    'progressive' => FALSE,
    'file' => 'users.inc',
  );

  foreach ($result as $row) {
    $batch['operations'][] = array('batch_create_user', array($row));
  }

  batch_set($batch);

  batch_process();
}

function batch_create_user($row, &$context) {
  // Here I'm just trying to get some output so I know the operation is called, I'm not actually importing the users yet.

  drupal_set_message($row->uid . ' : ' . $row->login);
  dd($row->uid . ' : ' . $row->login);

  $context['results']['processed']++;
  $context['message'] = $row->login;
}

function batch_import_users_finished($success, $results, $operations) {
  if ($success) {
    drupal_set_message('Importing users has finished.');
  }
  else {
    drupal_set_message('Some error.');
  }
}

Am I missing something or doing something wrong? Any help is very much appreciated.


texts:
I've read the questions already asked but they didn't answer my question. But they were sucessful in confusing me more. There are hooks, render functions of two types, theme functions, pre-processing functions, processing functions. In every question I read over internet the answer is different every time. My head's gonna explode.

Coming to question, I need just the text & href from menu-item or link. I'll handle the rest.

How I want it?

//I need control over the HTML wrapper elements for menu
foreach $menu_items as $menu_item:
    if(has_submenu($menu_item)):
        print "custom html here";
        foreach $menu_item as $sub_menu_item:
            print "custom html here".$sub_menu_item['name'].$sub_menu_item['href']."custome html here";
    endif
    print "custom html here".$menu_item['name'].$menu_item['href']."custome html here";


texts: Automatically scroll to content when block link clicked?

texts:
On responsive themes, where both sidebars and content areas collpase to 100% width,the distance between block links and their corresponding node content which come before or after all blocks is usually large. So user need to scroll down a lot to reach the desired content, which is obviously not a good user experience.

So I am wondering if there is any module/javascript/other solution to slide to the node's content whenever user clicks the link?


texts:
I have installed fbconnect module with Drupal 6 on Windows 7. Everything seems to be working fine. From front end I can login to my site via fbconnect. However when I try to run and drush script, for example drush updatedb, it throws me following fbconnect error

Message is

  WD php: Exception: Facebook needs the CURL PHP extension. in
  require_once() (line 19 of
  E:\wamp\www\foo\sites\default\modules\contrib_modified\fbconnect\facebook-php-sdk\src\base_facebook.php).
  Drush command terminated abnormally due to an unrecoverable error.

Edit: Curl is enabled but still I am getting this error, please see below screenshot


texts: While creating a node, I want to change the value of textfield using ajax based on the value of preceeding drop-down list. Here is the following code

texts:
function hook_form_alter(&$form, &$form_state, $form_id) {
        if ($form_id == 'form_id') {
                $form['field_parent_name']['und']['#options'] = $option_list;
                $form['field_parent_name'][LANGUAGE_NONE]['#ajax'] =  array(
                       'callback' => 'parent_display_name',
                       'wrapper' => 'field-parent-display-name-add-more-wrapper',
                       'method' => 'replace',
                       'effect' => 'fade',
                     );
           if (isset($form['field_parent_name'])) {
  $query = new EntityFieldQuery();
  $query->entityCondition('entity_type', 'node')
      ->entityCondition('bundle', 'account_node')
      ->propertyCondition('status', 1);

  $query->fieldCondition('field_node_name', 'value', $form_state['values']['parent_node'], '=');
  $result = $query->execute();

  if (!empty($result)) {
    $node_objects = node_load_multiple(array_keys($result['node']));
    $node_key = key($node_objects);
  }
  $gname = $node_objects[$node_key]->title;
}

         $form['field_parent_display_name'][LANGUAGE_NONE]['#value']=$gname;

        }}

    function parent_display_name(&$form, &$form_state) {
    return $form['field_parent_display_name'];
     }

I m not able to access $form_state . Even if I pass values like $gname=rand(),still no effect on ajax.


texts: Hook or event when Media file is inserted/updated/deleted but only when node form submitted

texts:
I created a field of type "Entity reference" and referencing an item of type Media. In other words its an image field.

I would like to execute code with an hook or an event when an image is added, changed or removed.
I don't know what's the proper way to do it since the reference to the image field is not "saved" until the complete node form is submitted.

For example if i remove the image and then refresh the page without saving the node form the original image will still be there. So i don't want a hook/event on the "remove" button but only when the complete node form is saved and the image deletion is processed.

Does this make sens?

More context:

Each time a Media field is used (image is added, changed or removed from any Media fields) I will call a remote service (a Digital Assets Management service) to add/change/remove a reference to this image.

I'm creating a module that will be reused on various website. So i can't assume the structure or the name of the fields. A node could have various level of paragraphs containing Media fields.

What i tried:

Created a Widget extending Drupal\entity_browser\WidgetBase so when the image is selected (and the widget function submit() is called) I make my remote call. It works but not really suitable since if someone adds an image and then decide to refresh the page without saving the main node form, the image would not have been saved but the remote call will have been done.
I tried to add actions on the Media buttons ("remove", "edit" and "add"). But it's kind of hackish and definitely doesn't seem to be the way to go.


texts: CCK field. how to use dynamic names to call CCK fields? (like: $node->$cckname)

texts:
I have several cck image fields. Each field has a consecutive name, for example:

field_photos_1,
field_photos_2,
field_photos_3,
field_photos_4
... until 20

So my question is: How to call the image fields in a loop?

for example (pseudocode:)

for($i = 0; $i >= 20; $i++){
$cckname = 'field_photos_'.$i; //$cckname is changing the image field name, then...
echo "<img src='/".$node->$cckname[0]['filepath']."'";
}

The question in a general way could be: how to use dynamic names to call fields?


texts: Failed attempt at moving Drupal 8 to a clean installation of my OS.

texts:
Okay, so ive reinstalled my ubuntu OS,  reinstalled the LAMP stack, ive restored the database and connected to it just fine. Ive checked which php modules drupal 8 requires and installed them, my version of php is above the 5.6 lower limit - i have not installed ALL of the php5-* modules in apt-cache though but i dont think thats an issue(?), ive set the chmod 777 . But now my /user/login kind of routes dont work, it just gives a 404. Have anyone experience anything like this, and how to solve?

I have looked at the clean_urls in my .htaccess, but drupal 8 clean urls should just work out of the box.


texts:
I got a webform and it seems to timeout after one or two hours, I want to increase the timeout session to like 4-5 hours or more.

How do I make this possible?


texts: How to add a reference to a view block in a field?

texts:
I am using Drupal 8. I created a block (hotel) with the Views module, and I would like to add a reference to the block in content type's field, but only custom blocks can be added. The hotel block cannot be added to a new field because it was created with the Views module.

How can I add a reference to a views block to a field? Alternatively, how can I convert a views block in a custom block?


texts:
I have module that I alter a form using hook_form_alter. In this alter, I add a submit function to the form that is defined in a include file that I included in the hook_form_alter implementation using the function module_load_include.

It works fine until I submit the form. Drupal does not find my submit function. Is there anyway to make sure that whenever a form is being processed/submit a file is included?


texts: Views templates deleted when core updated

texts:
Yesterday, I posted a proposal for clarifying the procedure for updating core. But now I find that I messed up in doing my update and I'm not sure how to do it right the next time.

I have a set of Views templates under the Bartik theme. They are in the folder:

<Drupal root>\themes\bartik\templates\views

In the update procedure, this folder is deleted along with the rest of the old core.

I was able to easily restore the views folder from the backup, but I'd like to not have to do that in the future.

Generally, it seems like a bad idea to put custom content in a core folder, but it seems that Views needs the template folder to be under the theme it applies to.

Is there a way to put that views folder under the sites folder or somewhere else outside of the core structure so it won't get deleted when I do an update?

Thanks for your help.


texts: How to set marks for scale questions in quiz module?

texts: I am using quiz module to set up a self-evaluation quiz, which consists of five scale questions, the answer of each question is preset (from "always" to "never"). After setting up the quiz I took a test, and got the result "...got 30 of 30 possible points.Total score: 100 %". Choose any answer I got the same result! I have already set in quiz that if the total score from 0-6 suggest result A, 7-12 suggest result B...However, I could not really get the correct result. I suspect it must be I have not defined the mark of each answer at different scale, but I could not find anywhere to define the marks. Can anybody help please?


texts:
We have a site that is throwing errors when uploading files to a simple "Page" node. I've done a lot of work trying to track down the actual source of the error, and I posted a half dozen messages to various likely threads at drupal.org.

The errors we get on file attach/upload:

  warning: Parameter 2 to wysiwyg_form_alter() expected to be a
  reference, value given  in /var/www/drupal/includes/common.inc on line
  2892.

  warning: Parameter 2 to simple_access_form_alter() expected to be a
  reference, value given in /var/www/drupal/includes/common.inc on line
  2892.

I understand about passing by reference versus value. I understand about fixing the problem in the offending module by using the two calls to drupal_alter(), as described on
http://drupal.org/node/930992#comment-4066840, but so far I have not been able to find what module is making the call incorrectly.

I tried installing and enabling the same set of modules on a test site but cannot reproduce these errors.

It's hard to post a bug report when you don't know the offending module.

See also http://drupal.org/node/1200970#comment-5463436.


texts:
Ok, admittedly I'm a composer novice. So, in my previous site, I used composer manager to update Drupal's core. That was pretty straight forward to use (just run "composer drupal-update"). However, composer manager now says it's deprecated.

  The Drupal 8 version of this module is deprecated and no longer needed, due to improvements in Drupal 8.1. Use Composer directly to get the needed modules, which will also download their required libraries.

So today I got a warning that I need to apply security updates to core, but I can't find any documentation on how you would update Drupal core with composer.

Is this done through Drupal Console, Drush or is it an actual composer command I need to run? I'm not very clear on what the preferred process is outside of "download the latest version of Drupal from drupal.org and replace all the files manually".


texts:
I'm using Drupal 7.
I wrote the following code in a token field, but when I refresh the node page, it doesn't show anything.

if (arg(0) == 'node') {
  $nid = arg(1);
  $node = node_load($nid);
  $s = $node->field_name['und']['0']['value'];
  echo $s;
}

Can you advise me what I should do?


texts: How do I change base URL when moving site from sub-directory to domain root?

texts:
I have developed a site in a sub-directory and now will be pointing a live URL to it. What do I need to do to ensure that the relative links in the menus etc will work under this new configuration. I have read that settings need to be changed in sites/default/settings.php however looking at the file it does not appear that a "base" URL is specified ... same with the .htaccess file under the root.
This may be a fundamental question, but in WordPress for example having a new "base" URL requires a settings change otherwise relative links will end up pointing to a 404 page ... how is this handled in Drupal (7)


texts: How to format 'node reference' field values from the Views module

texts:
How can I format the output of a 'node reference' field that is generated using a View?

Currently it's formatted as (See 2nd graphic): "FirstName - Lastname Pagetitle"

I'm trying to change that to: "Firstname Lastname"

Where do I modify this fields format?

Here is my current view:

Here is the 'node reference' output:


texts: Views Php how to select actual term name not term ID

texts: How to select term reference field with variables in views global PHP field?  I need to not Term ID, but actual term name. My views is fields of a content type that contains term reference field. And php field selects term reference fields as term ID. But I need actual term name.