texts: Location and Gmap relationship - what is alternative to show Location items on a google map?

texts:
Recently the Gmap module has described itself on the module page as now being a 'legacy' module.  If you have used this recipe in the past, you may be familiar with the long and unresolved issue of the project trying hard to migrate to Google Maps API v3.

Unfortunately, because of this issue, the Location and Gmap combination is no longer a viable solution to show Location based items on a google map.

What would be the current Drupal 7 equivalent recipe? I would prefer to keep the Location module in use as I need it for proximity searches, but I am open to suggestions.  Thanks for your ideas!


texts: Restrict Anonymous Users from accessing/viewing a Customized Form

texts:
I have created a form. The codes I used are below:

function myid_print_menu()
{
    $items = array();

    $items['user/%user/myid_print'] = array(
        'title' => 'Print an ID',
        'page callback' => 'myid_print_user_page',
        'page arguments' => array(1),
        'access callback' => myid_print_user_access(),
        'file' => 'myid_print.pages.inc',
        'type' => MENU_LOCAL_TASK,
        'weight' => -10,
    );
    return $items;
}

The code of the function that allows accessing the form:

function myid_print_user_access()
{
   if (user_access('perform_regular_task'))
   {
       return TRUE;
   }else{
       return FALSE;
   }

}

I was wondering that even if the user is not log-in the form can be access.

Looking at the module's permission:

I did not assign any permission for the anonymous user. Why it is so?


texts: How do I alter the text of the input field in the search form?

texts:
I need to alter the text of the search input field. In my quest to do this, I have  dpm() the content of $form on a call to hook_form_search_box_form_alter(). The output is the following.

Array
(
    [search_block_form] => Array
        (
            [#type] => textfield
            [#title] => Search
            [#title_display] => invisible
            [#size] => 15
            [#default_value] =>
            [#attributes] => Array
                (
                    [title] => Enter the terms you wish to search for.
                )

        )

    [actions] => Array
        (
            [#type] => actions
            [submit] => Array
                (
                    [#type] => submit
                    [#value] => Search
                )

        )

    [#submit] => Array
        (
            [0] => search_box_form_submit
        )

    [#form_id] => search_block_form
    [#type] => form
    [#build_id] => form-Y0XlzH4YO-EqVHxg5wnRf-PrnecuUSGdo5LTCPcLgLU
    [form_build_id] => Array
        (
            [#type] => hidden
            [#value] => form-Y0XlzH4YO-EqVHxg5wnRf-PrnecuUSGdo5LTCPcLgLU
            [#id] => form-Y0XlzH4YO-EqVHxg5wnRf-PrnecuUSGdo5LTCPcLgLU
            [#name] => form_build_id
            [#parents] => Array
                (
                    [0] => form_build_id
                )

        )

    [form_id] => Array
        (
            [#type] => hidden
            [#value] => search_block_form
            [#id] => edit-search-block-form
            [#parents] => Array
                (
                    [0] => form_id
                )

        )

    [#id] => search-block-form
    [#method] => post
    [#action] => /
    [#theme_wrappers] => Array
        (
            [0] => form
        )

    [#tree] =>
    [#parents] => Array
        (
        )

    [#validate] => Array
        (
        )

    [#theme] => Array
        (
            [0] => search_block_form
            [1] => search_box
        )

)

Is $form['search_block_form']['#title'] = ''; the right thing to do here?


texts: How to remove an option from an exposed filter with a drop-down list?

texts:
This is this drop-down list for the field field_gender on the view whose name is members:

M|Male
F|Female

I know the following callback is executed (tested with var_dump...), but it doesn't do what I think it should do: Provide only the option which value is "M" for "Male" (this choice is decided programmatically, Views UI won't work).

Here is the callback:

/**
* Implementation of hook_views_pre_...().
*/
// function mymodule_views_pre_render(&$view){
// function mymodule_views_pre_build(&$view){
function mymodule_views_pre_execute(&$view){
    if ($view->name == 'members') {

        // get our filters
        $filters = $view->display_handler->get_option('filters');

        // Force
        $filters['field_gender_value']['value'] = array('M' => 'M');

        // apply changes
        $view->display_handler->override_option('filters', $filters);
    }
}


texts: How to sync two different content types?

texts:
I'm going to build a website for a magazine.I have two different content types. In the first one, I will post the first page of magazine. But in the second one is for articles.
Now, my problem is:
I want to show just articles which are related to the issue which displayed on the top. I know how to show latest content [for first content type which includes first page], but i don't know how to show its articles under it. I guess,I would use views, but I don't know how.
to be more clear: I want something like this site.


texts: Grouping nodes by common CCK values in views

texts:
I can't think of a better title than that, but hopefully it makes sense once I describe it.

I have a node type with 3 CCK fields, we'll call them A,B,C and 1,2,3 and X,Y,Z.

Some nodes will be A,1,X and others will be B,3,Z and etc.

I want to create a view which will pull all of my nodes and list each unique option set as a row so all rows that are A,1,X are in a row with the # of results, and all B,3,Z's are in a row with the # of results.

Is what I want to do possible? If so - how?


texts: Creating a view that groups results by month/year

texts:
Does anyone know how to build a view that groups the results by Month/Year but can print the results expanded. Take the following dataset:

Events

    Event Name  Event Date
    ----------  ----------
    Event 1     2011-05-01
    Event 2     2011-05-15
    Event 3     2011-05-30
    Event 4     2011-06-04
    Event 5     2011-06-22
    Event 6     2011-07-01
    Event 7     2011-08-16
    Event 8     2012-01-01
    Event 9     2012-01-02
    Event 10    2013-05-15

I would like Views to output that data in the following format:

    May 2011
    --------
      Event 1
      Event 2
      Event 3

    June 2011
    ---------
      Event 4
      Event 5

    July 2011
    ---------
      Event 6

    August 2011
    -----------
      Event 7

    January 2012
    ------------
      Event 8
      Event 9

    May 2013
    --------
      Event 10

So the view would not actually be grouped in SQL it just needs to print out the events with headings visually grouped by month and year.


texts: How to inject code into node body after x paragraph

texts:
Trying to figure out if there is a way to inject code after the first or second paragraph on a node.

More specifically I am trying to inject an Adsense ad.

So far I haven't been able to find a solution or module that will do this.

Can anyone help?

I am not using paragraphs module. Just looking how to inject code right after the third or fourth  tags on the body of the node.


texts: How to embed user photo upload form in a page of Drupal 7 site

texts:
I want to embed user photo(avatar) upload form in a node page like this: node--37.tpl.php so a user can change or upload their profile picture by visiting a particular node.
Can't understand what to do, reading some api documentation like function form_load_include with no luck.Also i found an amazing snippet here but how to use it as a form?

$uid = 3;
$account = user_load($uid);

// suppose that a source user picture is located in the 'sites/default/files/upics'     directory.
// get image information
$image_path = 'public://upics/userpic.jpg';
$image_info = image_get_info($image_path);

// create file object
$file = new StdClass();
$file->uid = $uid;
$file->uri = $image_path;
$file->filemime = $image_info['mime_type'];
$file->status = 0; // Yes! Set status to 0 in order to save temporary file.
$file->filesize = $image_info['file_size'];

// standard Drupal validators for user pictures
$validators = array(
  'file_validate_is_image' => array(),
  'file_validate_image_resolution' => array(variable_get('user_picture_dimensions',     '85x85')),
  'file_validate_size' => array(variable_get('user_picture_file_size', '30') * 1024),
);

// here all the magic :)
$errors = file_validate($file, $validators);
if (empty($errors)) {
  file_save($file);
  $edit['picture'] = $file;
  user_save($account, $edit);
}

Please give me some ideas to get started, your help is really appreciated.
Thanks


texts: I've been working on a existing drupal site I got from a client, and have been running into some problems when I try to change the smtp settings. The SMTP module was already installed, but when I change the settings in SMTP Authentication Support and send a test mail, it works, but it still keeps using settings from somewhere else (I presume). I've checked the config files for settings, but I can't seem to find anything. All cache has been turned off. I'm not an expert on drupal by any means, so is there some other place I should be looking or do I need to change some other settings?


texts:
In a Commerce project, the customer should be able to choose between 2 options with a radio field, for some products only, with a different price for each option. When a customer selects a radio option, the unit price should be changed accordingly and with ajax, and the line item updated I guess.

We also need that the admin enter PRICE A, PRICE B in 2 commerce_price fields when he creates new products, not by rule calculation neither  +90 or -100 as in Commerce Pricing Attributes (because prices vary a lot and having to calculate each price difference would be a source of errors).

At the moment the lone idea I got to configure this is :

set a line item field with these radio options, shown in the add to cart form.
Then or a pricing rule which detects if the 2nd price exists, and is selected ; sets the 2nd price as the unit price ?

Or programmatically, with some hook ? Any suggestion would be really helpful.


texts: How to add embedded YouTube video at the end of ViewSlideshow - Drupal 6

texts:
I have a Slideshow view which loads two fields, main images ('group multiple values' unchecked to create rows) and video ('hide if empty' checked). It takes these from one node which it gets from the nid argument.

The slideshow currently displays 13 images but each image also has a seperate instance of the video attached to it.

I've tried playing about with the views-slideshow.tpl.php file and I've also tried excluding the video from display then manipulating the view ovject from withing hook_views_prerender() and hook_preprocess_views_view(), all with no luck.

I just want the 13 unique images with the single instance of the video link added to the end, therefore creating 14 unique slides. Ideally I would want to add 2 or 3 videos so the solution needs to account for this.


texts:
I have a module which implements token_replace. It is used to display a proper phone number in the banner depending on a customer type with a default value in place if we don't know, and is used for some data in e-mails along with the previewable email template module.

Occasionally the tags for tokens are left in place instead of being replaced. This only occurs during high volume as we can not reproduce the issue in a staging environment. Have any of you encountered token_replace intermittently being not called at all?

Clearing the class registry cache appears to resolve the issue temporarily but eventually it occurs again.

A Coworker did a write up of the issue for some people which I am including below in case his words are clearer:

Domain:  Drupal has a token replacement system in place, where it will replace [revel_soap:phone_number] with the phone number.  We have a module, revel_soap, which contains a drupal "hook", for tokens.  revel_soap_tokens is the function name. This is located in revel_soap.module. A module's files are included in the module.info file, files[] array. The .module file is supposed to be automatically included, where the bulk of the definitions for the module are included.

It is running either on one or two servers, with both configurations going through the load balancer, just either with one or two servers to choose from.

Problem:

We observed that when the site is running on one server, it is not having any issues. When we put the site on two servers, it works fine for up to 40-50 minutes, but then the replace_tokens function will not work, it doesn't call our method "revel_soap_tokens" to find values for the tokens. For the phone number, this isn't a big issue, but the main problem is that emails go out that depend on tokens, for activating a user. They will receive emails with broken links that would normally bring them back to the site and activate their account.

For the phone number issue, if the code is called, if the session values aren't present, it will fall through to the default case which returns a hard coded phone number. This leads us away from the diagnosis of a session issue, and towards a class registry issue.

The temporary fix to this is to clear the Drupal Class Registry. Phone numbers show up, and emails get generated correctly (more importantly).  We left the phone number issue in place so we can easily see when the problem occurs, through tools that we use / wrote.

During the time that this is happening, SOAP calls are still being made. Here is the files array for our .info file

files[] = "revel_soap_calls.inc"
files[] = "revel_soap.test"

The second one contains test calls and is not used otherwise.

When a module is included, the .module file should also be included. Our tokens hook should be present. However, on the two server environment, it appears that the tokens hook disappears.

I've added our .module file to the files[] array and watched it show up in the registry_files table after a Drupal cache clear. I've seen some modules include the .module file and others that didn't. I have not had a chance to test this on the load balanced environment.

We are running drupal 7.14.

Any ideas would be appreciated!


texts:
Possible Duplicate:
  How do I specify in which database my schema should be created?

I would like to create an entity module which discuss with another Drupal database.

In my module.install, this is ok :

db_set_active('otherdb');
if (!db_table_exists('mytable')) {
$result = db_query("CREATE TABLE mytable (
     id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
     title VARCHAR(255)
   );");
drupal_set_message("LOG :Creation of table mytable ok");
}
db_set_active();

but this can't be done with hook_schema  :

$schema['mytable'] = array (
'description' => 'The main store for our entity',
'fields' => array(
  'mytable_id' => array(
    'description' => 'Primary key for our table of mytable',
    'type' => 'serial',
    'unsigned' => TRUE,
    'not null' => TRUE,
  ),
  'title' => array(
    'description' => 'The mytable title',
    'type' => 'varchar',
    'length' => '255',
    'not null' => TRUE
  ),
),
'primary key' => array('mytable_id'),
);
db_set_active('otherdb');
return $schema;

Any ideas ?


texts:
I want to create a menu in footer looking like:

    MODA            ELEKTRONIKA        USŁUGI            (1)
-----\/-----      ---------------    ----------

Odzież         Buty        Sport             Dodatki     (2)

Crapp          Exco        The South Race    Vista       (3)
Horse          Gojas       Goo Snort         Ray-Bahn
Deserved       Dojczman    Basics            Chino Russi
Nara           Nice
Mosquito       E-book

It consists of:

Tabs - each tab contains its own columns
Columns - each column contains its own menu links
Menu links

All of them should be managed from admin panel. How to achieve it? I installed enter link description here QuickTabs but editing such menus may last very long. QuickTabs module lets you to manage tabs but how to manage columns and links? You can create multiple-level menus. However, column headers should NOT be clickable.

Is it possible to do it using existing modules or should I create my own module?


texts: Datepicker not appearing when an url alias is added

texts:
I've implemented a datepicker in a textfield on a basic page from Drupal. It works fine and the url shown is "http://....../drupal7/node/28".

If I add an url alias to the url, the datepicker doesn't appear. It only reappears if I remove the url alias.

Anyone know how to show the datepicker with an url alias?

The files used are:

jquery-1.10.2

jquery-ui.js

jquery-ui.css


texts: How to limit and enable Commerce shipping options based on the customer's country?

texts:
Very simple use case, using only flat rate shipping, with version 2 of Drupal Commerce Shipping and Drupal Commerce Flat Rate. I have two shipping options customers can choose between if they are in one country (the UK) and two if they're in any other country. Let's call them:

UK standard
UK special
International standard
International special

I've looked for ways to switch shipping rates on and off using rules, but all I can find is rules that apply a particular shipping rate, not rules which enable or disable options that the customer can then choose between.

This related question gives a faint outline of how to apply rates, but not how to enable or disable options, and likewise this related question, where there are 12 options but all are chosen for the customer (and the answers simply say "use rules"). Under the Calculation Rules tab under admin/commerce/config/shipping/services/flat-rate, I can't see anything in the "actions" list that looks like it enables or disables a particular rate. Plenty that appear to apply a rate, but not giving the customer a choice or limiting the choice.

This is clearly common and possible, as it's referred to for example in this issue, but I can't find anything on how to do it.

I've tried adding a rule like this through "Configure component" for a particular shipping rate, but it had no effect, the international rate still appears as an option even if the country is "United Kingdom". Here's the rule:

Here's another I tried using "Calculation rules" which, also had no effect:

Everything I can find around enabling or disabling shipping by country is about disabling countries completely.

I couldn't find anything in the Commerce Shipping documentation, and there is no Flat Rate documentation.


texts: Create Taxonomy with Hierarchy from an Array

texts:
How might I create a vocabulary full of taxonomy with a hierarchy from an array such as this:

$vocab = array(
  'level1-1' => array(
    'level2-1' => array(
      'level3' => array(),
    ),
    'level2-2' => array(
       'level3' => array(
         'level4' => array(),
       ),
    ),
  ),
);


texts: How do I index custom fields with the search API using elasticsearch?

texts:
I see all kinds of tutorials to get apache to index content.  Is there any difference in getting elasticsearch to index my new custom field?

On the field page I can see my field but when i expand it there is nothing to add.

Using this Create custom fields using custom Processors in Drupal 8 tutorial, but it doesn't seem to be working and no errors are being thrown so I don't know if my code is broken or this is apache specific.


texts: Configuration page in Modal Forms not working

texts: I already install Modal Forms in my localhost website and it worked perfectly, but now when I installed for my online website I can’t make any change in the configuration page, always forbidden page coming when I change the configuration and save it while I am admin user [Uid=1]


texts: Does changing the order of questions reflected in past quiz results too?

texts:
I have two quick questions about implementing the quiz module:]

I have the questions in a particular order and about 100 people have taken the quiz.  We have implemented the quiz results download module.  If I CHANGE THE ORDER of the questions (make question #3 the new question #1) will the results (old one in particular) automatically UPDATE or will we have ‘MIXED’ data – some with the old question numbers and some with the new ones?
As you know, there is an option to present responses (answer choices) in random order.  We had NOT checked that box.  If we now check that box, will the old data get automatically updated?


texts: Why is Drupal CSS/JS Aggregation files stored in sites/default/files?

texts:
The storing of the CSS aggregation files became problematic for me as our Central Safety Services (CSS) department also tried to store files in the sites/default/files/css folder and everything got wiped out.

Why doesn't it use a root folder, like [drupal root]/tmp or /cache or something other than where I store my files?


texts: How do I load a file in a managed_file field inside an edit form?

texts:
I'm building a custom module (Drupal 8) which implement new elements I called components. I have a component creation form which has a managed_file field which works well, it submits, save my image file at the correct path and create an entry in my managed_file table inside my database.

The problem is that I created an edit page for the so called components and I can't manage to load the component's image as the current image uploaded for this component in the manage_file field inside the edit form.

I've tried using #default_value and #value with the file fid and I tried inspecting the $form and $form_state to gather info but I can't manage to solve this.

Here is my field with the #default_value (not working, I've tried put the fid in array or not, as a string or as a number none working).

$form['thumbnail'] = [
        '#type' => 'managed_file',
        '#title' => $this->t('Thumbnail'),
        '#description' => $this->t('Upload a thumbnail of your component.'),
        '#required' => false,
        '#default_value' => ['42'],
        '#upload_location' => 'public://components_thumbnails/',
        '#upload_validators' => [
            'file_validate_is_image' => array(),
            'file_validate_extensions' => ['png jpeg gif jpg'],
            'file_validate_size' => array(5120000),
        ],
    ];

Did anybody manage to have an editable file field inside a form in Drupal 8? Do I have to switch from managed_file and use something else?


texts: How do I get the requirements in a module's composer.json merged into the consolidated composer.json?

texts:
I am trying to use composer correctly to install a library named nikic/php-parser.

Thanks to helpful comments by Clive, I now understand that when a Drupal 7 module comes with a composer.json file, that file is supposed to be merged into a consolidated composer.json-file, and from then on things will be taken care of more or less automatically.

That things are supposed to work that way also follows from this note on the Composer Manager project page:

  Composer Manager allows each contributed module to ship with its own
  composer.json file, listing the module-specific requirements. It then
  merges the requirements of all found modules into the consolidated
  composer.json file. This results in a single vendor/ directory shared
  across all modules which prevents code duplication and version
  mismatches. [My emphasis.]

The Drupal site where I use for testing is a fresh install of Drupal 7, organized as Drupal 7 is normally organized when you install it using drush (drush si standard).

The Composer Manager package contains a composer.json with the following requirement:

"require": {
    "php": ">=5.3.0",
    "nikic/php-parser": "^4.2"
}

I have the Drupal variable composer_manager_vendor_dir set to sites/all/vendor and the composer directory for the consolidated composer.json is set to  /sites/default/files/composer.

The consolidated composer.json currently contains:

{
  "require": {
    "symfony/yaml": ">=3.1",
    "php": ">=5.3.0"
  },
  "config": {
    "autoloader-suffix": "ComposerManager",
    "vendor-dir": "../../../all/vendor"
  },
  "prefer-stable": true
}

I.e., it does not include a requirement for nikic/php-parser. The note from the project cited above seems to imply that it would somehow be merged in automatically.  This is yet to happen on my test site.

Following up another hint by Clive, I ran:

drush composer-manager install

This resulted in:

Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
  - Installing symfony/yaml (v3.1.0)
    Downloading: 100%
Generating autoload files

I.e. it did the updates that was required per the consolidated composer.json. But it did not pay attention to the composer.json in the module's directory.

Trying:

drush composer-manager update

... did not resolve the issue.

There must be something fairly obvious I am missing.

How do I get the requirements in a module's composer.json merged into the consolidated composer.json (apart from splicing it in "by hand")?


texts: Views sortable table column exposes field name in url

texts: I have created a view that uses a table format with several columns. Via format settings, I have chosen some of them to be sortable (by checking the respective checkboxes and and selecting the default order). While this is working great, I have noticed that when clicking the sortable column in the ui, the respective url parameter "order" uses the actual machine name of the field, thus exposing internal db info (order=field_my_custom_field_name). Is there a way to adjust this so an alias is used instead? I am looking for a similar functionality as in "Filter identifier" for Filter Criteria


texts: How to add programmatically contextual link 'edit' to quiz question?

texts:
Since the way to get to a quiz question to edit it is very long, I want add a contextual link to each quiz question.

But somehow I struggle to find a solution. Because it is not a block and not a view.

I have something like this added to my menu_alter hook:

$items['node/%node/edit'] = array(
    'title' => 'Edit',
    'page callback' => 'node_page_edit',
    'page arguments' => array(1),
    'access callback' => 'node_access',
    'access arguments' => array('update', 1),
    'weight' => 0,
    'type' => MENU_LOCAL_TASK,
    'context' => MENU_CONTEXT_PAGE | MENU_CONTEXT_INLINE,
    'file' => 'node.pages.inc',
  );

and added render($title_prefix) to my template. But somehow it does not work. I know I have to add contextual links to my page at all - but how can I archive this?


texts: How to redirect language prefix to language domain (TLD)

texts:
I have a single Drupal 7 install running in 2 languages, on 2 domains, but currently using a language prefix as selection. Content can be access as follows:

  English
  mysite.com/content/wonderful
  mysite.de/content/wonderful

  German
  mysite.com/de/content/wunderbar
  mysite.de/de/content/wunderbar

I will change to domain language selection, so that one language is accessible on each domain:

  Englishmysite.com/content/wonderfulGermanmysite.de/content/wunderbar

The setup works wonderfully on my dev server, but all the old links with the /de/ language prefix will be broken.

Is there a way to 301 them all with one fell stroke? Or how can I detect and strip the prefix in /de/content and at the same time redirect to .de/content? Is this best accomplished in .htaccess?

For German content, the appropriate redirect pattern would be as follows:

  mysite.com/de/content/wunderbar -> mysite.de/content/wunderbar
  mysite.de/de/content/wunderbar -> mysite.de/content/wunderbar

Since English has no language prefix, how can I subsequently detect English content that is trying to be accessed on the .de domain and redirect accordingly?


texts: How to remove width and height from image field images in Views?

texts:
I'm using Views to generate some HTML, and this includes a field from a Views field.

My problem is, the layout needs the images to be reponsive (height and width based on the parent element), but this is being broken by Views writing in the width and height as HTML attributes which override all the CSS.

I've tried the answer to this question which uses hook_field_attach_view_alter() to remove the width and height from the output array - but it doesn't work, the width and height are still written into the HTML.

Checking the width and height values at the time hook_field_attach_view_alter() is called, it seems it's a timing problem: it looks like this is called before the image preset is applied. E.g. my image preset is 190px x 190px scale and crop: at the time hook_field_attach_view_alter() is called, the width and height are the original width and height of the image, then the 190 gets written over whatever changes the hook makes.

Is there another hook I can use for the same effect?

I also tried using Rewrite results in Views to re-create the image from its component parts. The problem is, it has access to everything except the actual image URL or URI:

Is there a way to access the image URL or URI in the replacement patterns for Views rewrite for an image field?


texts: Possible to show 'Request new password' tab with LoginToboggan 403 login page?

texts:
I'm using the LoginToboggan module to password protect a page.  A login area successfully shows on the page in question, but there are no tabs, only a username and password box.

Here is what it looks like:

This is what the I want it to look like (screenshot taken from /user on same site):

I can't see any option for it in the configuration (here is what I have currently as config under the login section):

I can't find anything relating to this in the LoginToboggan issue queue or via google.  Has anyone experienced this? Is there any way I can make the tabs display?

P.s. I was going to log a support request on the issue queue of LoginToboggan but I saw the following statement:

Support requests will only be responded to if they deal with the development of the
module, or possibly its use with another module. End users should consult the forums or
IRC chat rooms or hire a consultant for support.


texts:
I Installed [search api solr module][1] and solr-5.5.2 server.
When I tried to add server in drupal backend(/admin/config/search/search-api/add-server) , I'm getting warning message as shown in attached image and I'm not able save the settings.Can anybody help me in this?
http://192.168.88.89:8983/solr/#/drupal8  is my solr server which is running

Though i added the configuration, why i'm not able to save.Is there any other settings? I have moved solr-conf/5.x files to server/solr/drupal8/conf.


texts:
I added a couple of user Views in my Drupal 7 site and enabled the blocks on the dashboard.

I am now getting the below error messages:

Notice: Undefined index: user-report-block in dashboard_page_build() (line 192 of /home/mysite/public_html/modules/dashboard/dashboard.module).
Notice: Undefined index: user-report-block--2 in dashboard_page_build() (line 192 of /home/mysite/public_html/modules/dashboard/dashboard.module).

Why might this be the case, and how do I get rid of the error messages?

I tried disabling all the blocks from the dashboard, clearing the cache, and doing an update.php did nothing; the error messages are still shown.


texts:
Our organic groups is set up so that any authenticated user can create a group. What we need is for any group created to be private (accessible only to group members), but if the creator requests it be public, then the group is initially created as private and be in a published usable state, but a request will be sent to a groups admin for the group to be public (which will then list it in a group directory and anyone can request to join).

I'm using Drupal 7 and the latest version of OG. I have it set up so the group visibility defaults to private right now.

Any way to do this with rules? I've tried creating a "list in public directory field" associated with the group content type and then I figured when a group was added, a rule could check if that field was checked and do some event to notify an admin. But I'm not sure where to start with the "React on event" drop down as it doesn't seem anything suits what I'm trying to do.

I'm open to other ideas.


texts: Using hook_node_submit() from a custom module

texts:
I have built a custom module named 'ABC'. I have created a content type 'CT' having some text fields. When a user add content of type 'CT' and Save/Preview the form, I want to use the values that the user added in the form and make a web service call and update the form values based on the data returned from the web service call which would further be saved to database.

I am using hook_node_submit() as below.

function CT_node_submit($node, $form, &$form_state) {
  global $user;
  //dpm($user);
  $nameofuser = $user->name;
  $timezone = $user->timezone;
  $title = $form['field_title']['#value'];
  $pid = $user->uid;
  $pname = $user->name;
  $rurl = $form['field_recording_url']['#value'];
  $purl = $form['field_presenter_url']['#value'];

  $kdetails  = array (
     'nameofuser' => $nameofuser,
'title' => $title,
'pid' => $pid,
'pname' => $pname,
  );
  Make_A_WebService_Call($kdetails, $form, $form_state);
}

The problem is that when I am calling the above code from ABC.module file, the code is not being called on clicking the Save/Preview button.


texts:
I'm using a view which is rendering the Product displays as DisplaySuite modes.

Right Now, the generated code for the price looks as follows.

HK$100.00/Month

In order to achieve a similar rendering as

I need to split the decimal part and the currency into their own markup.

Any idea about how to do that in a clean fashion ?


texts: Specify the view mode when the node is displayed on modal window (ajax)

texts:
Is possible to specify the view mode using the default modal Ajax functionality?

I'm using this and it works, but I need to theme the node in a different way inside the modal

Open Modal


texts: How to decide between Activity or Heartbeat (or DIY Rules?)

texts:
I wish to create a site with status updates, and thus I want people to see those status updates.... (I am looking at the Facebook Style Statuses / Statuses module.)

It seems that I need to use either Activity or Heartbeat modules to get a stream of activity. However they both do similar things. How do I choose between the two? Is there a comparison anywhere?

I've seen a lot of discussion comparing them back in 2009 and talking about creating a unified version. However that discussion doesn't take into account Drupal 7 and doesn't seem to have resulted in a clear winner.


texts: Don't know where 404 error is coming from

texts: Don't know where this 404 error "sites/all/modules/lightbox2/images/blank.gif" is coming from. It's on everypage on www.lostinthesmoke.com. Can't find the reference to it in the page source. I don't know if its Drupal or CloudFlare. CloudFlare says its Drupal or my server. I cleared caches everywhere. I had lightbox2 installed a couple months ago but not on this fresh install. I use this domain to learn and test on. It started showing last night.


texts: What does a value like node:{node_type} mean?

texts:
I'm trying to fully understand Drupal 8 routing. I understand the basics, no problem, but some of the finer details are still a mystery.

Here's the route for adding a node from the node module.

node.add:
  path: '/node/add/{node_type}'
  defaults:
    _controller: '\Drupal\node\Controller\NodeController::add'
    _title_callback: '\Drupal\node\Controller\NodeController::addPageTitle'
  requirements:
    _node_add_access: 'node:{node_type}'
  options:
    _node_operation_route: TRUE
    parameters:
      node_type:
        with_config_overrides: TRUE

I'm struggling with the line _node_add_access: 'node:{node_type}'.

I understand what the _node_add_access key does. It refers to a service with a tag of applies_to: _node_add_access. That is provided by the NodeAddAccessCheck class.

What does the node:{node_type} do?  No amount of tracing through code has answered that for me. It looks to be a unique value for some purpose. Is it related to caching?

I haven't got to the options stuff yet.

Thanks

EDIT: I'm not sure if this should be an answer but these applies_to requirements seem to be read in Drupal\Core\Access\CheckProvider::applies and the value (e.g. node:{node_type}) doesn't seem to be used at all.


texts: Assigning content from one user to another user automatically after a payment

texts:
I am evaluating Drupal for a new project but I am not very experienced with Drupal so far.

The project is based around a custom content type created by role-A user and then re-assigned to role-B user once role-A has accepted the re-assignment and role-B user has made a payment. When the node is re-asssigned to role-B user, role-B user will only be able to modify one of the fields of the node.

Does anybody have any ideas of how to do this without the need for the admin to manually re-assign each node to a different user and change the permissions for the fields?


texts:
I have a content type say sample. I've created a view page to slideshow all sample content type. I have an exposed filter at the top of the page, people search using id there, on searching it is giving the correct result with the slider but the slider is'nt working at the result page. I want it show the result first and then the others.

Is it possible.


texts: I downloaded the Pathauto module to have the taxonomy aliases generated dynamically. The problem is that the pattern apparently expects a fixed depth, while my taxonomy is not that stiff - some items have one, and some up to 3 branches underway. Can such a scenario be addressed by pathauto?


texts: Updating of drupal core and modules impossible

texts:
I have several different drupal sites (all hosted seperately). Some of them run on 7.22, and some of them run on 7.26.

For some reason the update.php script does not seem to work anymore. I can visit the page and it correctly shows the first step: Verify Requirements is shown in green and I see the Overview step. When I press the Continue button the browser starts loading and never finishes. I have tried this a dozen time, every time with the same result. I tried this on the hosted environment and on my home envirentment (installed a backup of the site).

One site is fairly small so I did a clean install of 7.26, installed all the modules, articles, etc. Same result. I am at a complete loss and now unable to install updates of drupal core and modules. Please help.

BTW 1: I use these modules in all of my sites: ctools, ckeditor, imce, lightbox2, views, metatag token.

BTW 2: nothings strange to be found in Apache error.log and php-errors.log

EDIT: Just found out that this is a known issue for IE. Tried this in Chrome and it works fine. Hope others with the same problem find this post sooner than I found the anwer


texts: Can 1 FullCalendar show dates from more than one content type?

texts:
I want to show "dates" and "Board Meetings" on my FullCalendar.  How?

Background info:
In D7 I created a Calendar using the wizard, which shows titles and dates/times of events that I create using a content type "Date" that the wizard created.  Works great.  But then I added another content type "Board Meeting" with a date field, the Board meetings only show up on the preview, not on the calendar month view itself.  How to get them to show on the calendar?

Dave N


texts: I upgraded my website to D6 to D7 successful but only with the development version (not in production) and I've new datas in production since (Drupal 6). So I'm wondering the best way for update the Drupal 6 database to the Drupal 7 database.


texts: Libraries shared by more than one installation?

texts:
I am working with several Drupal 8 installs On a shared hosting environment.
I've got them up and running and they are looking great thanks to the MoreThanThemes themes I'm using. I'm at the stage of adding modules that require libraries.

It would be great if I could simply maintain libraries in a folder like  /Home/[accountname]/Libraries outside of the Drupal root folder. In this way several installs could rely on a common set of libraries, and these wouldn't have to be maintained per site (as would be the case if they were stored in /Home/[accountname]/[sitefolder]/Libraries for example).

An equivalent would be storing private files in a folder like /Home/[accountname]/Files.

Would this be possible?

I know that many are very strong advocates for using Composer, but I am interested in answers that do not require using that tool.


texts: How to restore a site from a backup done with Backup and Migrate module using Drush

texts:
Just that. I've a backup using the backup and migrate module. I've done some changes and now the site is down. I can't restore the site using the admin interface (because it's broken).

Can I use Drush to restore it?


texts:
The following code, let's login any user programmatically.

global $user;
$user = user_load(<any_uid>);

My question is how does the above code triggers to set new user cookies on browser, at this point we are not even regenerating session.


texts: View published content - but only if you posted it

texts: I have two different users on my site, content posters and content reviewers.  The posters should only be able to view their own content, but reviewers need to be able to see everyone's content.  I tried to set this up using permissions, but permissions only gave me control over editing and deleting (not viewing, except for the over-arching "View published content" which seems to refer to everything.)   How do I accomplish my goal?  I am using views to present the users with different pages of content... Could I effectively limit content viewing by using views?  How can I prevent an unauthorized person from visiting a views page?


texts: How to save node text and comment text to session or cookie while typing

texts:
This site does a great job saving the text input even when a question or answer hasn't been posted.

Is there a similar feature available in Drupal?


texts: Views Accordion to be accessible by keyboard

texts:
I need the Views Accordion module in Drupal 7 and what is in it to be accessible by the keyboard. When you are tabbing, it skips it completely. Also the screen reader does not recognize the closed items.

Anything I can modify to achieve this?


texts:
I successfully managed to create a custom URL made of a fixed part, and a user submitted value, such as http://somepage.com/userinput.
After submitting, this URL is opened in the same window; I need to open it in new window.

Is it possible to achieve this using template override, or any other way?


texts: How to name the template for the node of a specific view?

texts:
Hello I find difficult to name the node of a view.

I created HTML-list view (but can be grid, table, unformatted etc) named topic.

I can theme its whole page using:
views-view-list--topic.tpl.php

But I need a template just for the item in the list:

teaser here...

How do I name the template? I have hundreds suggestions in View>Theme:Information but all they work either for all view or on particular fields.

I tried the most eligible: node-view--topic.tpl.php (this won't work)/ views-view-list--topic.tpl.php (this one works but for all page)

Many thanks


texts:
i'm trying to build a Headless Drupal app with symfony, i'm stuck with login, i build a custom module for drupal 8 with four functions, (login,logout,register,login_status):

<?php

/**
 * @file
 * Contains \Drupal\remoteuser\Controller\RemoteUserController
 */

 namespace Drupal\remoteuser\Controller;

 use Drupal\Core\Controller\ControllerBase;
 use Drupal\Core\Form\FormState;
 use Drupal\Core\Entity;
 use Drupal\user\Controller;
 use Symfony\Component\HttpFoundation\JsonResponse;

class RemoteUserController extends ControllerBase
{
  public function login() {
    $form_state = (new FormState())->setValues($_POST);
    \Drupal::formBuilder()->submitForm('\Drupal\user\Form\UserLoginForm', $form_state);

    // Check for errors from the from
    if ($errors = $form_state->getErrors()) {
      // Return errors to notify the client.
      return new JsonResponse( array( 'error' => $errors ) );
    }
    else {
      // Return new user session to client.
      $uid = \Drupal::service('user.auth')->authenticate($_POST['name'], $_POST['pass']);
      $session_manager = \Drupal::service('session_manager');
      $session_id = $session_manager->getId();
      return new JsonResponse( array( 'uid' => $uid, 'session_id' => $session_id ) );
    }
  }

  public function register() {
    // Validate the e-mail address first.
    if (!\Drupal::service('email.validator')->isValid($_POST['mail'])) {
      return new JsonResponse( array( 'error' => 'Invalid e-mail address' ) );
    }

    // Create password if it was not provided.
    $password = $_POST['pass'] ? $_POST['pass'] : user_password();

    /** @var \Drupal\user\Entity\User $user */
    $user = entity_create('user', array(
      'name' => $_POST['name'],
      'mail' => $_POST['mail'],
      'pass' => $password,
    ));

    // Validate the object.
    $errors = $user->validate();

    if ($errors->count() > 0) {
      // Return errors to notify the client.
      return new JsonResponse( array( 'error' => $errors->__toString() ) );
    } else {
      // Save new user
      $user->save();
      // Return new user credentials
      return new JsonResponse( array( 'user' => $user->toArray() ) );
    }
  }

  public function logout() {
    $result = user_logout();

    return new JsonResponse($result);
  }

  public function login_status() {
    $uid = \Drupal::currentUser()->id();

    $session_manager = \Drupal::service('session_manager');
    $session_id = $session_manager->getId();

    return new JsonResponse( array( 'uid' => $uid, 'session_id' => $session_id ) );
  }
}

all working great except for login !, it authenticate and returns successfully the user, but when i check with login_status, it returns an anonymous user !!. but the magic is that when i test with Postman google chrome plugin, login_status returns successfully the logged in user !!, maybe the cookies are not handled correctly in symfony !! i tried also with Drupal 7 Rest services, same problem, the user is not logged in !!


texts: Install profile with variable default language messes up translations

texts:
I'm working on an install profile for a Drupal app that can be delivered in several languages. The app was developed with English as the default language, but some installations might be in Arabic only.

The problem is that Arabic-language installations of this profile show the English menu items, field labels, etc. When I examine the strings in the localization UI, it shows the English string next to the default language, which is now Arabic. Only strings from the "default" textgroup are appearing correctly for some reason.

Now I am aware that there is an issue with default language vs source language in i18n. I would appreciate if someone could offer a workaround for my particular situation.


texts: Is it a bad practice to use dynamically generated IDs for theming

texts:
Is it a bad practice to have styles such as these in the css files ?

#block-block-1, #block-block-7, #block-block-8

I mean, if one was to delete the block and recreate it the styles would no longer be valid.

Or is it best to modify the template and target the selectors in the template ?


texts: Printing views exposed sort criteria separately to exposed filters

texts:
Exposed filters are either:
- Printed in views-view.tpl.php using the $exposed variable.
- Printed in a block, probably using the same variable.

This variable ($exposed) contains the exposed sort criteria and filters. I would like to find a way to print them separately. Ideally there would be  a way to use something like:

<?php print $exposed->sort; ?>

<?php print $exposed->filter; ?>

Does anyone know of a way you can achieve this? Or in last case how to print each sort and criteria individually?


texts: How to specify granularity for the Access log Timestamp field to display access log entries using Views?

texts:
Normally when you select a date field in Views there is the option to specify the 'granularity'. Ie: Day, Hour, Minute etc... ie: When you add the 'Post date' field from a node.

Does this functionality not exist at all for the 'Access log: Timestamp' field, when displaying access log entries using Views?

This would be really helpful for displaying simple custom statistics, but it doesn't seem to exist and I'm not sure where to even look to add the functionality to the relevant module!


texts: Can't add iframe to paragraph - iframe is stripped for attributes

texts:
I have a problem with adding an iframe to a paragraph.

In Text formats and editors, I have checked "Limit allowed HTML-tags" and then added <iframe> to allowed tags.

But when adding an iframe tag with attributes to the CKEditor, all attributes are removed and only the tag is remaining.

When I uncheck "Limit allowed HTML-tags", the iframe is shown as expected but I do want to restrict HTML tags.

Is this a bug or am I adding the tag wrong?


texts: Why does simpletest report a missing schema for my Drupal 8 module?

texts:
My module is working as expected with the following settings, config and config export. But when I try to run tests, I get the following error. I'm not sure what is wrong.

  Drupal\Core\Config\Schema\SchemaIncompleteException: Schema errors for riddler.settings with the following errors: riddler.settings:riddles missing schema in Drupal\Core\Config\Testing\ConfigSchemaChecker->onConfigSave() (line 102 of /var/www/sb/sboss/docroot/core/lib/Drupal/Core/Config/Testing/ConfigSchemaChecker.php).

# settings.yml
riddles:
 -
    question: 'Do you really hate Spam?'
    response: 'Yes!'
langcode: en

--------------------------------

#schema
riddler.settings:
  type: config_object
  riddles:
      question:
        type: label
        label: 'Question'
      response:
        type: label
        label: 'Response'

#config export

riddles:
 -
    question: 'Do you really hate Spam?'
    response: Yes!
  -
    question: 'What''s your favorite primary color?'
    response: 'blue, yellow, red'


texts: Token are not working in my content type fields (they show as they are)

texts:
I need to have display on all pages a specific token. I have my own content types and I would like fill them with my tokens as well.
I noticed the tokens shows up as they are not as their values.

How can I make tokens display correctly?


texts: How to set title on node creation using token in action rule

texts:
I've a action rule that add a node of type "profil". The aim is to set the title of that node to the author name (i've got fields for that...)

Here is an export of rules section do :

"DO" : [
  { "entity_create" : {
      "USING" : {
        "type" : "node",
        "param_type" : "profil",
        "param_title" : "[account:field_identite:given] [account:field_identite:family]",
        "param_author" : [ "account" ]
      },
      "PROVIDE" : { "entity_created" : { "entity_created" : "Entit\u00e9 cr\u00e9\u00e9e" } }
    }

The param title which i want to be composed by two fields ( given name + family) doesn't work. I've got an empty title at creation.

If i put only the given name it works, but export is different :

"param_title" : ["account:field_identite:given"],

Notice that the " are not in the same place (has if the token was recognized )

So i've tried to import :

"param_title" : ["account:field_identite:given"] ["account:field_identite:family"],

But i've got an error during importation process in rules.

Does someone knows hwo to have composed tokens ?

Any Help will be appreceated
Thx


texts: Multiple Values does not work when field widget is "Autocomplete term widget (tagging)"

texts:
In Drupal 7, multiple values does not show for fields which are "Autocomplete term widget (tagging)"

Please look at the attached screenshot.

I'm trying to make 3 separate tags,
and want it to appear as the following:

Payment accepted:
Interac, cash, Watcard

But I'm not able to do so using commas. It works as plain text but I need it to be linked separate tags. Is there an easy solution to this? I'm new to drupal and don't really know much about coding.

Thanks for your help!


texts: Admin URL path in commerce shipping view?

texts:
I am setting up a Shop with Drupal Commerce 2 currently. I installed the Commerce Shipping Module and customized everything to my needs. The only thing I wonder about is, that the URL for the default view of a single order shipping item uses the admin path admin/commerce/orders/%/shipments/%. So, If i give a user the permission to "show own shipments", the user will use the /admin-path too.
Is this normal by design, or should I create another view with an URL-pattern like /user/uid/shipments/%
What would be considered best practise for this case? Or is it completely irrelevant if users use the /admin-path as well? Thank you very much in advance!


texts:
I just need to review/explore the array of built in checkout_panes so that I can debug it. However, the following code does not display any result.

<?php

function mymodule_commerce_checkout_pane_info_alter(&$checkout_pane) {
//Does not work
dpm ($checkout_pane);
//Does not work
drupal_set_message ($checkout_pane);
//Does not work
drupal_set_message (print_r($checkout_pane));
?>

It might be too basic but being a beginner in drupal/PHP I have already spent a day trying to resolving it. Any assistance will be highly appreciated.


texts:
How do i get the value of a checkbox from another form/page and how do i make it so if the checkbox is enabled, it'll allow a button to be visible?

checkbox in SettingsForm.php:

$form['#tree'] = TRUE;
    $form['clients_enabled'] = array(
      '#title' => t('Enable PixelPin OpenID Connect'),
      '#type' => 'checkboxes',
      '#options' => array('pixelpin' => $this->t('Enable')),
      '#default_value' => $clients_enabled,
    );

button ion LoginForm.php:

public function buildForm(array $form, FormStateInterface $form_state) {
    $definitions = $this->pluginManager->getDefinitions();
    foreach ($definitions as $client_id => $client) {
      foreach ($this->pluginManager->getDefinitions() as $client_name => $client_plugin) {
        if (!$this->config('pixelpin_openid_connect.settings.' . $client_id)
          ->get('enabled')) {
          $url = \Drupal::service('path.current')->getPath();

          $find = 'login';

          $pos = strpos($url, $find);

          if ($pos === false){
                $value = 'Register Using @client_title';
            } else {
                $value = 'Log in with @client_title';
            }

          $element = 'clients_enabled[' . $client_plugin['id'] . ']';
          $form['pixelpin_openid_connect_client_' . $client_id . '_login'] = array(
            '#type' => 'submit',
            '#value' => t($value, array(
              '@client_title' => $client['label'],
            )),
            'visible' => array(
              ':input[name="' . $element . '"]' => array('checked' => TRUE),
            ),
            '#name' => $client_id,
            '#prefix' => '<div>',
            '#suffix' => '</div>',
          );
        }
      }
    }
    return $form;


texts: Accessing custom block fields from a template file

texts:
I have a sidebar region "Sidebar Ad" and placed in that region is the custom block "Sidebar Ad" of type "Image" which has two fields "Image" and "Link".

When I output the block on my page using {{ page.sidebar_ad }}, I get the image and the link separate from each other, which is to be expected. What I can't figure out, and I've been trying for around 5 hours now, is how to reference the fields separately so I can wrap the link around the image.

Does anyone know how to reference those fields? Am I going about this the wrong way?

I've successfully pulled the link URL by overriding the specific block template and referencing:

{% block content %}

{% endblock %}

Referencing the image URL still eludes me.


texts: Can I get dependent services into a custom class without creating a service?

texts:
I've got a class hierarchy where I need to be able to instantiate different objects within the hierarchy.  Instead of using global functions, I'd like to use injected services from the container via $this within those objects.

When researching this, it seems as though the only examples I can find involve creating a service, such as Dependency injection in a custom class.  However, I don't need a new service.  If I did create one, wouldn't I need to create one for every class within the hierarchy so that they could be instantiated?  This seems excessive.

If my parent class implements ContainerInjectionInterface and I have a create() method to inject the services, can I just instantiate the objects this way, or is it bad practice?

$thing = OneOfMySubClasses::create(\Drupal::getContainer(), ...);


texts: Add HTML to Page Title for Entity (Profile2)

texts:
I have a Profile2 page where I want to add some HTML into the page title (I want to insert a fontawesome icon). I am using Display Suite to layout the Profile2 page with a custom view mode.

I have succeeded in over-writing the title using the function hook_profile2_view_alter() and drupal_set_title(), but drupal_set_title() uses check_plain, which strips out all the extra html. I tried using hook_preprocess_page, but there is no title variable available. I think this is because Display Suite takes over the title variable, and renames it as label. I also tried the html_title module without any luck, as I'm pretty sure this is because it only works on nodes and not on entities. I also tried hook_preprocesss_profile2 (having first used mymodule_preprocess_entity(&$variables, $hook) to create the function suggestion), but this function doesn't seem to be running on the page. I'm not sure if this is because I'm using display suite or a custom view mode.

Any help much appreciated, as I seem to be running out of options.


texts:
Is there a way around to get Share with All Groups option in the group audience field for a specfic group content type.With share with All Group I mean to say share content to all groups we are not even if are not member of.
I am using og module on drupal 7 installation.


texts: How do i programmatically add 'people fields' in Drupal 8

texts:
I'm trying to programmatically add fields that are manually added here:

  /admin/config/people/accounts/fields

I'd want to add the fields when an admin enables my module/extension.

I've tried this in my MODULE.install file:

function openid_conect_enable() {
  field_cache_clear();
  field_associate_fields('user_alternative');

  //Given name field.
  if (!field_info_field('field_given_name')) {
    $field = array(
        'field_name' => 'field_given_name',
        'type' => 'text',
    );
    field_create_field($field);

    // Create the instance on the bundle.
    $instance = array(
        'field_name' => 'field_given_name',
        'entity_type' => 'user',
        'label' => 'Given Name',
        'bundle' => 'user',
        // If you don't set the "required" property then the field wont be required by default.
        'required' => TRUE,
        'settings' => array(
           // Here you inform either or not you want this field showing up on the registration form.
            'user_register_form' => 1,
        ),
        'widget' => array(
            'type' => 'textfield',
        ),
        'display' => array(
          'default' => array('label' => 'above'),
      ),
    );
    field_create_instance($instance);
  }
}

but with no success.


texts: How to redirect old url alias to new url alias?

texts:
Is there any way to redirect old URL alias to the new URL alias?

I want example.com/good-news to redirect to example.com/good-news-index, automatically.


texts: Redirect the users to the page they were watching before logging in or registering an account

texts:
I have a custom login, sign-in and sign-up page in two tabs; I want logged-in users to be redirected to the same page they were watching before logging in or creating an account.

How can I achieve this?


texts: I've installed TinyMCE editor but when I change font style or anything else, I don't see any change in the published node. what should I do?


texts:
In D7 i want to let admin add custom text(description) to each user profile and add point to users .
for example the user profile must be like this :

  John
     Description : You'r not good at speaking
  point : 12

  Joe
    Description : You'r perfect
  point : 20

Thx


texts: How do I change the rate modules output to "# of users like this"?

texts:
I am using the Rate module.

The current display for my thumbs up widget is:

(thumbs up image) 2 users have voted, including you.

I would like to change it to:

(thumbs up image) 2 users like this

How do I change the default tpl to accomplish this?

print $up_button;

if ($info) {
  print '
' . $info . '
';
}

if ($display_options['description']) {
  print '
' . $display_options['description'] . '
';
}


texts: How can a description be added to the body field summary widget in node edit form?

texts:
On a particular content type I have made summary input required by checking both
"Summary Input" and "Summary required" on the body field settings.
We would like to add a help text to the summary field on the resulting form. I have tried using hook_form_BASE_FORM_ID_alter as seen below which is working for the title field.
$title_description = 'Why we need a title.';
$title_widget =& $form['title']['widget'];
if (empty($title_widget[0]['value']['#description'])) {
  $title_widget[0]['value']['#description'] = $title_description;
}

I am having a hard time finding the summary in the $form array however.
To recap how can I alter this widget to add a description?


texts: one view for each term or one view for all terms

texts:
I have a vocabulary that contains terms and child terms, I would like to create a view to show the content of each child term.

Parent Term 1 > Child Term A
              > Child Term B
Parent Term 2 > Child Term C
              > Child Term D

So do I have to create 4 views for child terms (A, B, C, D)? Or I can create one view that show each child term in its page? and if it one view how to define path for them?


texts: Custom jQuery code loaded but not working

texts:
I am trying to implement some custom jquery code for a 3D menu on my Drupal 7 site. I created two .js files one with the code and other one calling it on page. I have succesfully loaded both .js files throug my theme's .info file, however nothing happens, even tho i know the js code is 100% correct and working as it should. Im also using jQuery update module set to 1.8 so that shouldn't be a problem. As i am less than a begginer regarding jquery, i ask for your help. I can't understand why is code being loaded but not working. Thanks for reading and all the answers.

(function ($) {

   var Menu = (function() {

    var $container = $( '#rm-container' ),
        $cover = $container.find( 'div.rm-cover' ),
        $middle = $container.find( 'div.rm-middle' ),
        $right = $container.find( 'div.rm-right' ),
        $open = $cover.find('a.rm-button-open'),
        $close = $right.find('span.rm-close'),
        $details = $container.find( 'a.rm-viewdetails' ),

        init = function() {

            initEvents();

        },
        initEvents = function() {

            $open.on( 'click', function( event ) {

                openMenu();
                return false;

            } );

            $close.on( 'click', function( event ) {

                closeMenu();
                return false;

            } );

            $details.on( 'click', function( event ) {

                $container.removeClass( 'rm-in' ).children( 'div.rm-modal' ).remove();
                viewDetails( $( this ) );
                return false;

            } );

        },
        openMenu = function() {

            $container.addClass( 'rm-open' );

        },
        closeMenu = function() {

            $container.removeClass( 'rm-open rm-nodelay rm-in' );

        },
        viewDetails = function( recipe ) {

            var title = recipe.text(),
                img = recipe.data( 'thumb' ),
                description = recipe.parent().next().text(),
                url = recipe.attr( 'href' );

            var $modal = $( '

' + title + '

' + description + '
See the recipex
' );

            $modal.appendTo( $container );

            var h = $modal.outerHeight( true );
            $modal.css( 'margin-top', -h / 2 );

            setTimeout( function() {

                $container.addClass( 'rm-in rm-nodelay' );

                $modal.find( 'span.rm-close-modal' ).on( 'click', function() {

                    $container.removeClass( 'rm-in' );

                } );

            }, 0 );

        };

    return { init : init };

})();
 })(jQuery);

And here's the content of other JS file which is calling the function.

(function ($) {

$(function() {
Menu.init();
});
})(jQuery);


texts:
I need the functionality of google like "Did you mean". There is no solution for Search API Database. Though it is available for Solar Search.

Is there some thing i can do with views to achieve this ?

Any suggestions please.

Thanks


texts:
I've added an image field in a content type, and set the 'Field Settings' -> 'number of values' to unlimited, which means users can upload unlimited images for this field.

Then I build a view for this content type and expose the image filed to the view. What I'd like is to expose only image in teaser view, and all images in the full view.

I use a template preprocess function

function MYTHEME_process_field(&$vars) {
  $element = $vars['element'];
  // Field type image
  if ($element['#field_type'] == 'image') {
    // Reduce number of images in teaser view mode to single image
    if ($element['#view_mode'] == 'teaser') {
      // something might be wrong here
      $item = reset($vars['items']);      // not working
      $vars['items'] = array($item);      // not working
    }
  }
}

In debugging this function, this 2 lines

  $item = reset($vars['items']);
  $vars['items'] = array($item);

It doesn't seem to work because the image field in the content type can have multiple images.


texts: How to access phone contacts from PhoneGap in DrupalGap?

texts:
I'm really new to DrupalGap and PhoneGap. I have a question, how can we access the phone contacts in DrupalGap? I want to list the mobile numbers and other contact details in the application. Then select some of the contacts and store in the Drupal database.

The steps I followed:

Installed PhoneGap
Created PhoneGap project
Contacts pulgin installed for the project
Copied the DrupalGap to the www folder of the project
Done the necessary settings changes
Created a custom module to access the contacts from PhoneGap in laptop

I found some code snippet to access the contacts in PhoneGap as follows:

function sync_contacts_get_contacts() {

    // specify contact search criteria
    var options = new ContactFindOptions();

    options.filter = "";      // empty search string returns all contacts
    options.multiple = true;  // return multiple results
    filter = ["displayName"]; // return contact.displayName field

    // find contacts
    navigator.contacts.find(filter, onSuccess, onError, options);
}

function onSuccess(contacts) {
    for (var i=0; i<contacts.length; i++) {
        if (contacts[i].displayName) {  // many contacts don't have displayName
            alert(contacts[i].displayName);
        }
    }
};

// onError: Failed to get the contacts
//
function onError(contactError) {
    alert('onError!');
}

How can I access this in DrupalGap module I created and store in Drual database?

SOLUTION:

Later in my research I realized one of my misunderstanding. Contacts, camera etc. are work only in device. That means "navigator.contacts" cannot test in the web browser. we have to build the .apk file and install that in the device and test.

Instead of writing the contacts getting code, we can use the PhoneGap plugin from this location: https://github.com/dbaq/cordova-plugin-contacts-phone-numbers.

Using the custom service I stored the contacts in Drupal database. Link: http://docs.drupalgap.org/7/Services/Create_a_Custom_Service

To create the .apk file we have to follow the URL: http://docs.drupalgap.org/7/Compiling_a_Mobile_Application/Preparing_PhoneGap/Installing_PhoneGap/index


texts:
I create a views and filter node title , with expose filter.
how to change it to work like Google . don't have apply button and filter on time.
is it possible ?


texts: Entity Error While Running update.php from 8.6.14 to 8.9.1?

texts:
I have been trying to update the core from 8.6.14 to 8.9.1. I am facing the below error while running drush updb comments
> [error]  Field storage definition for 'revision_id' could not be
> found.  [error]  Update failed: paragraphs_update_8022  [error]
> Update aborted by: paragraphs_update_8022  [error]  Finished
> performing updates.

I have used the below comments for updating the core

removed vendor
removed composer.lock
composer remove --dev webflo/drupal-core-require-dev
composer update (after changed the core version in composer.json)
drush updb
drush entup

I am not sure how to solve this error? Please someone guide me on this?
Thanks for advance!


texts:
Display the suffix for the field 'price', i use:

<?php
print $node->field_price['und'];
?>

but only it render the value without the suffix ($)


texts: Programmatically delete one entry from one field on one entity

texts:
What's the proper way to programmatically delete one specific field entry for a multi-entry field from one specific entity? (that's specific fields and specific entities, not field types or instances and entity types)

Here's some possibilities I've looked into which don't work:

Loading the entity with entity_load(), setting the field entry to =null or =array(), then saving with field_attach_update(). It's the closest I've found but it leaves a zombie null field entry in the database which shows up as a blank row on forms until the form is saved and hook_field_is_empty() can kick in (hook_field_is_empty() is configured such that =null or =array() will flag as empty).
Loading the entity with entity_load(), unsetting the field entry by key, then saving with field_attach_update(). This seems to do nothing - it seems that Drupal interprets the entry not being there as a sign to not modify it. (strangely I also sometimes get maximum query time expiration timeouts when trying this approach)
field_attach_delete() - this is much too blunt: it kills all fields for the entity
field_purge_data() - better, but still too blunt: it kills all entries of the field, not specific entries

So to clarify, I've got code that finds (and loads) an entity which has a field that has multiple entries, and finds a specific entry on that field that needs to be removed. I want to remove that entry completely, without touching any other entries or any other fields on the entity.


texts: Open Atrium Space and Group parent relationship

texts:
I'm looking for documentation (or just advice) on setting up Space - Group parent relationships for Open Atrium. I've viewed a number of Open Atrium webinars and sifted through documentation, but surprisingly, I haven't found much on this specific topic. Most of what I've found simply refers to group members of spaces, but that does not (as far as I can tell) imply anything about how exactly that membership is configured. An example is this Building Blocks + Case Study PDF.

For most use cases, it seems to make sense that top-level groups would be the parents of spaces, with something like the following:

Group 1

-Space 1

-Space 2

--Sub-space

Group 2

-Space 1

-Space 3

Are there use cases for having the spaces as parents? What are the implications for user permissions and access control inheritance?


texts:
Following up with my previous question, I need to set and retrieve a cookie in two difference places:

set - inside postSave() in a Webform handler
get - inside an event subscriber.

In looking around, it seems that there are a few different options for tools, such as \Symfony\Component\HttpFoundation\Response and \Symfony\Component\HttpFoundation\Cookie, or GuzzleHttp\Cookie\SetCookie and GuzzleHttp\Cookie\CookieJar.
For setting the cookie, if I try this in my webform handler:
$values = $webform_submission->getData();

$response = new Response();
$cookie = new Cookie('Dixon customer info form', $values['destination_url'], 0, '/' , NULL, FALSE);
$response->headers->setCookie($cookie);
$response->send();

I get redirected to a blank page. If I try this:
$values = $webform_submission->getData();

$cookie_jar = new CookieJar();
  // Get the current host.
  $host = \Drupal::request()->getSchemeAndHttpHost();

  // Set a cookie for the specific form.
  $cookie = new SetCookie([
    'Name' => 'formEnterCookie',
    'Value' => $values['destination_url'],
    'Domain' => $host,
    'Secure' => FALSE,
  ]);
  $cookie_jar->setCookie($cookie);

no cookie gets set. Using either option, how do I set my cookie within my webform handler?


texts:
I have been trying to get the download results of a webform and it has'nt worked

Here are the steps I have followed

I have checked the temp folder and .tmp files have been generated


texts: I am aware of the watchdog table in the Drupal database, but I am not sure how to use it effectively.  Is it simply a message function that adds to the table like a stack in the database for debugging?  I have found old references to modules and odds and ends in content, but have not located a broad discussion of different ways it can be used effectively.  Also, how do I get the reports?


texts:
In my module, I have defined the following route:

custom_module_page:
path: 'new/post/{term-id}'
defaults:
    _controller: '\Drupal\mymodule\Controller\myModuleArticleController::content'
requirements:
    _permission: 'access content'

options:
parameters:
  term-id:
    type: 'term:tid'

in the controller

class myModuleArticleController extends ControllerBase
{
public function content(  TermInterface $term = null , Request $request) {

      $term_object = \Drupal\taxonomy\Entity\Term::load($term);

      print_r ($term_object)

this code works now, but instead of "term-id" in path , I want to use term slug in path

custom_module_page:
path: 'new/post/{term-name}' // **this will be term slug ( ex: my-taxonomy-name )**
defaults:
_controller: '\Drupal\mymodule\Controller\myModuleArticleController::content'
requirements:
_permission: 'access content'

options:
parameters:
 term-name:
   type: 'term:name'// **is this right? term name**

and what should i do in controller to get taxonomy id from taxonomy-slug?


texts:
I am discovering one problem on my page - as a content I have some recipe. Under it, I've created a block which is displaying "Simular recipes". And now, this block is displaying some simular recipes AND the one which is in the content page above.
So, I would like to ask if someone can help me how to do filtering to make this block not showing me the recipe which is in the page. Basically, need to block the node which I am currently in.
Thanks in advance.


texts: How to upload image to Amazon S3 using the AmazonS3 module?

texts:
I installed the AmazonS3 module, and I have the option to upload an image to AmazonS3: (screenshot of image field settings below)

Is it related to configurations under admin/config/media/file-system? If so what value should I put in Public File System to save files directly to Amazon S3?

I already tried the following: s3:// but it didn't work.
I am using the AmazonS3 module: https://drupal.org/project/amazons3


texts: A content type with two or more view displays with custom URLs

texts:
I have a content type that requires different views.  I am defining multiple view modes in the content type manage display page and using view page mode.  This works fine if the url is /%/{view mode} as defined in the view page module.  However, we would like the view's url alias to be a custom alias.

Default view alias:  /subpath/[node:title] (Pathauto pattern)
View 1: /%/myview which translates to /subpath/[node:title]/myview  (View Page Mode)

We'd like /%/myview to have its own alias like /mysubpath/[node:title] .

From what I understand, Pathauto alias works only with default views.  How can I make this happen?


texts:
I don't understand the following:

In Drupal 7's default .htaccess file the Apache module mod_expires is ordered to let files without a .php extension expire after two weeks.

How is web development with this setting possible? When I change a .css file, I want the changes to be reflected immediately. Do browsers ignore the expiration setting?

I've stumbled upon this issue because I'm currently experiencing troubles with a Varnish caching system. I currently do not know what causes my files not to be refreshed immediately.


texts: Changing hash throw: Uncaught Error: Syntax error, unrecognized expression

texts:
I want to change the hash in the URL when I trigger an action (a click for instance) using a pattern like #/param-1=foo&param-2=bar
In a fresh Drupal 8 theme, when I try this, I got an error saying
Uncaught Error: Syntax error, unrecognized expression: #/test=0
It works fine when I try with #param1-foo_param2-bar but I would like more flexibility. It looks like jquery is trying to consider the hash as a selector and returns an error that says it's not a valid selector.
Here is the code I use on a fresh classy based theme:
(function ($, Drupal) {
    Drupal.behaviors.myModuleBehavior = {
        attach: function (context, settings) {
            $('.layout-container', context).once('myModuleBehavior').each(function () {
                $('.site-name a').on('click', function (event) {
                    event.preventDefault();
                    event.stopPropagation();
                    console.log("clicking on logo");
                    window.location.hash = "/test=0";
                });
            });
        }
    };
})(jQuery, Drupal);

And here is the result I get from chrome console:


texts: Programmatically delete a webform submission by sid without first loading it

texts:
Drupal 8 project has a 2 webforms:

Webform "ABC"
Webform "123"

Explanation of the process:

When Webform "ABC" is submitted, a new "node" is created and the "Sid" used to create this node is recorded inside a "text" field (field_submission_sid) on this created node.

Now, when Webform "123" is loaded, the value of (field_submission_sid) is populated inside a 'text' element (submission_to_delete)... and when the Webform "123" is submitted, a custom handler will delete the submission of sid value = (submission_to_delete)

The custom handler is working but I believe there is a better solution... so please I need your help ?

Custom handler:

<?php

namespace Drupal\custom_module\Plugin\WebformHandler;

use Drupal\Core\Session\AccountInterface;
use Drupal\Core\Serialization\Yaml;
use Drupal\Core\Form\FormStateInterface;

use Drupal\node\Entity\Node;

use Drupal\webform\WebformInterface;
use Drupal\webform\Plugin\WebformHandlerBase;
use Drupal\webform\webformSubmissionInterface;
use Drupal\webform\Entity\WebformSubmission;

/**
 * Delete a 'webform Submission' using its "SID" retrieved from a populated webform submission value.
 *
 * @WebformHandler(
 *   id = "Delete a webform Submission using its sid",
 *   label = @Translation("Delete a webform Submission using its sid"),
 *   category = @Translation("Entity Delete"),
 *   description = @Translation("Delete a webform Submission using its sid retrieved from a populated webform submission valu"),
 *   cardinality = \Drupal\webform\Plugin\WebformHandlerInterface::CARDINALITY_UNLIMITED,
 *   results = \Drupal\webform\Plugin\WebformHandlerInterface::RESULTS_PROCESSED,
 *   submission = \Drupal\webform\Plugin\WebformHandlerInterface::SUBMISSION_REQUIRED,
 * )
 */

class DeleteSidWebformHandler extends WebformHandlerBase {

  /**
   * {@inheritdoc}
   */

  // Function to be fired while submitting the Webform.
  public function submitForm(array &$form, FormStateInterface $form_state, WebformSubmissionInterface $webform_submission) {
    // Get an array of the values from the submission.
    $values = $webform_submission->getData();

    // Load 'submission' object from webform-submission populated data.
    //get (SID) from (submission_to_delete) text element available on the webform
    $sid = $values["submission_to_delete"];
    $webform_submission = \Drupal\webform\Entity\WebformSubmission::load($sid);

    //Delete the Submission
    $webform_submission->delete();
 }
}

If you notice, I am loading the submission first then i am deleting it...

is there a better solution where I can delete the submission directly without first have to load it ?
maybe something like $webform_submission = \Drupal\webform\Entity\WebformSubmission::delete(submission_to_delete);

UPDATE:

I noticed if the 'webform submission' is not available (Ex: An admin deleted by mistake) so the value of $sid will be NULL and the below error is generated:

Error: Call to a member function delete() on null in Drupal\custom_module\Plugin\WebformHandler\DeleteSidWebformHandler->submitForm()

How to add an if statement to check if $sid value is empty then do nothing otherwise execute code.

Thank you,


texts: How do I load external JavaScript before local JavaScript?

texts:
I try to load JavaScript with drupal_add_js(), but it's not easy, and after fixing the loading of external JavaScript, I faced off a loading order issue: My external JavaScript is loaded after my local ones, and I would like the opposite behavior. Is it possible with Drupal 6?

Additional problem but optional: Is it possible to load these in footer instead of the header?

This is my code.

function d6_ce_susy2_preprocess_page(&$vars){
    //http://www.zites.net/en/load-external-javascript-files-drupal-6/
    $external_js1 = 'https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js';
   drupal_add_js('document.write(unescape("%3Cscript src=\''. $external_js1 .'\' type=\'text/javascript\'%3E%3C/script%3E"));', 'inline');
    $external_js2 = 'http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.11.3.min.js';
   drupal_add_js('document.write(unescape("%3Cscript src=\''. $external_js2 .'\' type=\'text/javascript\'%3E%3C/script%3E"));', 'inline','header');
    $external_js3 = 'http://cdnjs.cloudflare.com/ajax/libs/masonry/3.3.2/masonry.pkgd.min.js';
   drupal_add_js('document.write(unescape("%3Cscript src=\''. $external_js3 .'\' type=\'text/javascript\'%3E%3C/script%3E"));', 'inline');
   drupal_add_js(drupal_get_path('theme', 'd6_ce_susy2') . '/js/jquery_init.js','theme');
   drupal_add_js(drupal_get_path('theme', 'd6_ce_susy2') . '/js/js_jquery_new.js','theme');
   drupal_add_js(drupal_get_path('theme', 'd6_ce_susy2') . '/js/jquery_exit.js','theme');
   drupal_add_js(drupal_get_path('theme', 'd6_ce_susy2') . '/js/js_jquery_defaut.js','theme');
      }


texts: Bringing modules into project as git submodules - .info file doesn't have version info

texts:
I'm adding modules into my git-enabled Drupal project as git submodules. Things seem to work fine except that when I bring in a git submodule and use the version I want, by doing a 'git checkout 6.x-1.1' for example, the resulting .info file doesn't have the following information (with this example taken from zen):

; Information added by drupal.org packaging script on 2011-04-05
version = "6.x-2.1"
core = "6.x"
project = "zen"
datestamp = "1302017816"

Whatever is added by this drupal.org packaging script is apparently added when the archive is prepared for download on drupal.org, and isn't added when the commit is tagged with a certain version in git. Now will these modules even be considered valid by Drupal when I try to enable it? And if so, I'm sure this would screw up the update process because update won't know what versions of existing modules it's comparing against.

So how can I fix this? I must have missed something, because clearly there's no way every git user can be expected to manually add in this metadata for every module every time they update.


texts: Is there a special way to list Commerce Products?

texts:
Drupal core 8.2.6
Drupal Commerce 8.x-2.0-beta5
Bootstrap 8.x-3.2

I tried making a View that renders Products in view mode (Grid of Products in Default view), but when I try to add a product to cart - if the product has no variations - often times a wrong product that has no variations gets added. If the product that I try to add has variations I get a php error: InvalidArgumentException: Unknown attribute field name "attribute_period". in Drupal\commerce_product\Entity\ProductVariation->getAttributeValueId() (line 260 of drupal/modules/commerce/modules/product/src/Entity/ProductVariation.php).

Other attributes pop up there as well if I add a different product to cart.

It seems like it still tries to add a different product but provides the right variation name, which the different product does not have, so it errors.

If I view just the product on its own - works just fine. So for now I have the view show a table of products with "View" link, but I'd really like to be able to add products to cart right from the view. Any ideas for how to make that happen? I can't seem to find any tickets about this issue.


texts:
I'm using the Views slideshow module and jQuery cycle plugin, but the latter isn't recognized by Drupal 6.

this is the message I get:

  Cycle library Non installé Please download the Cycle library from
  http://malsup.com/jquery/cycle/ and place it in
  sites/all/libraries/cycle.

The plugin is already into my libraries folder as "jquery.cycle"; if I change it to "cycle", the Views slideshow module stop working.

How should I fix this?


texts: Custom drupal module does not appear on the extend page

texts:
I have created a custom module, yet it does not appear on the extend page.
I have my_new_block.info.yml file in modules/custom/my_new_block/:

name: My New Block
description: Create own blocks.
package: Garage

type: module
core: 8.x

dependencies:
  - block

In addition, when I try to install any drupal module with composer, it also is not recognised in the extend page.
What can be wrong?


texts: Commerce Stripe and 2.0 version of library with namespace?

texts:
I am working on an integration with Commerce Stripe and the new Connect functionality.  This however requires the 2.0 version of the library which can be found here https://github.com/stripe/stripe-php/releases.

I have downloaded the source code for this and put this in my stripe-php directory.  The stripe-php library has a namespace of Stripe.  I have defined my hook_libraries_info as follows

function bh_test_namespace_libraries_info() {
  return array(
    'stripe-php' => array(
      'name' => 'Stripe API Client Library for PHP',
      'vendor url' => 'https://stripe.com/',
      'download url' => 'https://github.com/stripe/stripe-php',
      'dependencies' => array(),
      'version arguments' => array(
        'file' => 'VERSION',
        'pattern' => '/(2.\d+(\.\d+)?)/',
      ),
      'files' => array(
        'php' => array(
          'init.php',
        ),
      ),
    'xautoload' => function($api) {
        $api->namespaceRoot('Stripe', 'lib');
    },
),
);

}

I have installed the xautoload module.  However, the classes are still not loaded.  Does anyone have an idea as to what I am doing wrong?


texts:
I'm trying to share a webform, but I cannot find the option to do so. I disabled the experimental module, re-enabled it, and flushed the cache,  but still is not showing up.
I'm running Drupal 9.0.8 and Webform 6.0.0-alpha20.
I could use this on Drupal 8 sites, but it doesn't work on two sites running on Drupal 9.
PS: I tried to access the D8 route to the share option and I got "Access denied"
path: /admin/structure/webform/manage/form_name/share


texts: The date module provides a handy widget for specifying a date.  Is there something similar on Drupal 6 for specifying a length of time such as 6 months or 3 days?  The time span will need to be converted to or stored as seconds for use by my module.


texts: Multilingual Site information field with hook_form_alter

texts:
I have added a field to my site information settings page by using hook_form_alter:

function site_fields_form_alter(&$form, $form_state, $form_id) {
if ($form_id == 'system_site_information_settings') {
 $form['site_information']['site_fields_slogan2'] = array(
  '#type' => 'textfield',
  '#title' => t('Slogan 2'),
  '#default_value' => variable_get('slogan2', TRUE),
 );
 $form['#submit'][] = 'site_fields_form_submit';
 }
}

...but the field doesn't appear on the multilingual variables page to be able to translate it. I've tried adding '#localize' => TRUE but this doesn't seem to work. Ay ideas?


texts: How to decide to create a content type or two if there are both common and uncommon fields?

texts:
I have a content type that has about 80 fields.
It has a select list field at top and there are two options: Yes or No.
If Yes is selected all the 80 fields are used and if the No is selected, the last 30 fields are not used. For both two options, 50 fields are common.
I wonder, if I should go for creating two content types for this structure, or if continuing  with "one" (only) is better. If I continue with this "one" content type, 30 fields will be empty for the "No" options and can it be a "bad" thing for the database (waste of space etc.)?
(If I continue with one content type I will use some modules such as Conditional Fields etc).
Is there anybody faced with a similar situation and is there a "better" way?
(Additional information: this content type is used for an academic resource. If the resource is in English I will only fill the 50 fields. If the resource is in another language I will fill the 50 fields and also fill the other 30 fields.)


texts:
I have field "myfield" in a node. The field is created in the content, not by hook. I want to change the value of that field. I do not want to display the value from database, but my value let's say random number. I tried to do this with hook_node_view and with hook_entity_view but I cannot change it on the display. Here is my code:

function mymodule_node_view($node, $view_mode) {
  if ($node->type == 'my_node_type') {
    if ($node->nid == 46) {
      $node->myfield['und'][0]['value'] = 55;
//or I tried with $node->content and no success
    }
  }
}

What am I missing? Can you help me, please!
Thanks you in advance!


texts:
Alright everyone, I'm sure this is a relatively simple thing, but I'm on the verge of tearing my hair out.

What I'm trying to accomplish is setting up images to appear in a grid, that when clicked pulls up a gallery/carousel, allowing you to scroll through the images there as well.

I've downloaded the slick modules, and correct dependencies. I also have bootstrap correctly set up as well. Honestly if you have an alternative your prefer more, please let me know.

https://www.drupal.org/project/slick
-https://github.com/kenwheeler/slick/
-https://github.com/gdsmith/jquery.easing
https://www.drupal.org/project/slick_media
https://www.drupal.org/project/media_entity_image
https://www.drupal.org/project/video_embed_field
https://www.drupal.org/project/blazy

Drupal 8


texts:
i have a for loop

{% for row in rows %}
    {{ row.content }}
{% endfor %}

will print out like this

 one

 two

 three

 ...

but what i want to is access the values using a key so i can pull the values individually so i can do some thing like this

 one

 one

 one

basically print the value anywhere i want on a div of my choice. Is it possible ?? please help

this is for a views template


texts: How to change number of item per page in taxonomy page?

texts:
I have multiple content types. I want to change number of item per page in teaser mode and  it is different for every content type.

In admin/config/system/site-information we can change number of item for all content types. But I want to change number of items for each content type.

What do I do? Please help.

.


texts: How can I create a Node Paragraph's image translation programatically?

texts:
I'm trying to create a translation on a node's paragraph field whose paragraph contains a text field and an image field. The code below updates the text field as expected but the image field is always blank/empty for the translated node:
<?php
   $img[] = array(
            'target_id' => 1029,
            'alt' => 'Translated alt tag',
            'title' => '',
        );
        $desc1[] = array(
            'value' => 'Translated Text',
            'summary' => '',
            'format' => 'basic_html',
        );
        $lang_node->field_images_descriptions->entity
            ->addTranslation($lang_code, [
                'field_product_image' => $img,
                'field_product_description' => $desc1,
            ])
            ->save();


texts: Search API Autocomplete not working with search_api_db

texts:
I have created a view page for search functionality. Following modules I have enabled:

Search API
Search views
Database search
Entity API
Views
Views UI
Ctools

Search API Autocomplete

I followed this link to achieve search functionality. How to use Search API Autocomplete combined with above mentioned modules so that I get auto-complete drop-down suggestions.


texts: Views API custom table not showing fields

texts:
I'm creating a custom view that corresponds to my module's table.

I already called the hook_views_api() hook.

function sample_views_api() {
    return [
        'api' => 3,
        'path' => drupal_get_path('module', 'sample')
    ];
}

To generate the view I called the hook_views_default_views() hook.

function sample_views_default_views() {
    $view = new view;
    $view->name = 'sample';
    $view->description = '';
    $view->tag = 'default';
    $view->base_table = 'sample_table';
    $view->human_name = 'Sample';
    $view->core = 7;
    $view->api_version = '3.0';
    $view->disabled = false;

    $handler = $view->new_display('page', 'Page', 'page');
    $handler->display->display_options['path'] = 'sample';
    $handler->display->display_options['menu']['type'] = 'normal';
    $handler->display->display_options['menu']['title'] = 'Sample';
    $handler->display->display_options['menu']['weight'] = '0';

    $views['sample'] = $view;

    return $views;
}

But when I opened my generated views. The fields of the corresponding table does not show.

Any way to show the fields? Am I missing something to register the fields?


texts:
We have a Drupal Commerce cart. The pricing can be altered based on discounts that come in from an external database via XML httprequests. It worked -fine- when the XML requests were made when the user hit the 'Add' button. But another developer removed that code and now wants the XML requests to be made on the cart form.

The problem I'm having is that it appears that the cart wants to display -before- my code will trigger and update the line items.

So... is there a way to hook onto a cart form/view so that my update code fires -before- the view is actually rendered? Below is a snippet. What happens is that the default pricing displays and -then- when the user hits the 'Update Cart' button, the code fires and updates the pricing with the discounts from the external database.

function formxml_form_alter($form, $form_state, $form_id){
global $user;
if(! $user)
  return;

if($form_id == 'views_form_commerce_cart_form_default')
      $order = commerce_cart_order_load($user->uid);

     // request pricing from external site and store in array
 $request_string = 'http://mysite/Start?CartID=' . $customer_number . '&Cust=' . $customer_number . '&Cntact=' . $contact_number;
    $result = drupal_http_request($request_string, $options);

$seq = 1;
foreach ($order_wrapper->commerce_line_items as $line_item_wrapper) {
    $line_item = $line_item_wrapper->value();
    $my_product_id =  $line_item->commerce_product[LANGUAGE_NONE][0]['product_id'];
    $product = commerce_product_load($my_product_id);
        $my_product_title = rtrim($product->title);
            // update each line item with prices from external db array
            ...
     }
    // now save order
$form_state['order'] = commerce_order_status_update($order, 'cart', TRUE);
commerce_order_save($form_state['order']);


texts: Permission issue: users can´t create content from certain computers

texts:
I am having a problem.

Users from a particular rol have permissions to create content.

When trying to create content from the office, we receive a message saying we have no permissions to do so. When connecting with the same user from other location, we receive no such message and we are able to create content.

Tried creating one new user with the same rol and the same problem.

Tried reseting roles and permissions and the same problem

Any ideas?


texts: Using hook_menu() with hook_permission() - Access denied

texts:
Can someone see anything wrong with this hook_menu() and hook_permission() code? I am able to see the permissions in the admin menu, admin/people/permissions. I allow access to los user front for authenticated users and save the settings. Then, I  clear all caches and try to access los/register. I am getting You are not authorized to access this page. when I try with either administrative or authenticated users. I have cleared the cache, logged in and out and even closed the browser and restarted it refreshing ever step of the way.

/**
 * Implements hook_permission
 */
function los_permission() {
  return array(
    'los user front' => array(
      'title' => t('LOS User Frontend'),
      'description' => t('Access to LOS user frontend.'),
    ),
    'los user back' => array(
      'title' => t('LOS User Backend'),
      'description' => t('Access to LOS user backend'),
    ),
    'los admin back' => array(
      'title' => t('LOS Administration Backend'),
      'description' => t('Access to LOS administration backend.'),
    ),
  );
}

/**
 * Implements hook_menu
 */
function los_menu() {
  $items = array();

  $items['los/register'] = array(
    'title' => 'LOS Register',
    'description' => 'Large order system registration page',
    'page callback' => 'drupal_get_form',
    'page arguments' => array('los_register'),
    'access arguements' => array('los user front'),
  );

  //... more $items here ...

  return $items;
}